summaryrefslogtreecommitdiff
path: root/plugins/OStatus/OStatusPlugin.php
diff options
context:
space:
mode:
authorEvan Prodromou <evan@status.net>2010-08-04 12:07:49 -0700
committerEvan Prodromou <evan@status.net>2010-09-13 11:44:20 -0400
commitd9b959fc64e4e36b0957afd33482f480b24868f9 (patch)
tree457d229fe31f1c70e8fccd17472faf6ba93a340a /plugins/OStatus/OStatusPlugin.php
parent9aadd3cb4216f2917858b5a4eacfc5e3dc17a9ac (diff)
move code for making activities from OStatus plugin to Subscription and Fave classes
Diffstat (limited to 'plugins/OStatus/OStatusPlugin.php')
-rw-r--r--plugins/OStatus/OStatusPlugin.php44
1 files changed, 10 insertions, 34 deletions
diff --git a/plugins/OStatus/OStatusPlugin.php b/plugins/OStatus/OStatusPlugin.php
index 77bc9872b..b182438dc 100644
--- a/plugins/OStatus/OStatusPlugin.php
+++ b/plugins/OStatus/OStatusPlugin.php
@@ -553,25 +553,10 @@ class OStatusPlugin extends Plugin
return true;
}
- $act = new Activity();
-
- $act->verb = ActivityVerb::FOLLOW;
+ $sub = Subscription::pkeyGet(array('subscriber' => $subscriber->id,
+ 'subscribed' => $other->id));
- $act->id = TagURI::mint('follow:%d:%d:%s',
- $subscriber->id,
- $other->id,
- common_date_iso8601(time()));
-
- $act->time = time();
- $act->title = _("Follow");
- // TRANS: Success message for subscribe to user attempt through OStatus.
- // TRANS: %1$s is the subscriber name, %2$s is the subscribed user's name.
- $act->content = sprintf(_("%1$s is now following %2$s."),
- $subscriber->getBestName(),
- $other->getBestName());
-
- $act->actor = ActivityObject::fromProfile($subscriber);
- $act->object = ActivityObject::fromProfile($other);
+ $act = $sub->asActivity();
$oprofile->notifyActivity($act, $subscriber);
@@ -744,24 +729,15 @@ class OStatusPlugin extends Plugin
return true;
}
- $act = new Activity();
+ $fav = Fave::pkeyGet(array('user_id' => $user->id,
+ 'notice_id' => $notice->id));
- $act->verb = ActivityVerb::FAVORITE;
- $act->id = TagURI::mint('favor:%d:%d:%s',
- $profile->id,
- $notice->id,
- common_date_iso8601(time()));
-
- $act->time = time();
- $act->title = _("Favor");
- // TRANS: Success message for adding a favorite notice through OStatus.
- // TRANS: %1$s is the favoring user's name, %2$s is URI to the favored notice.
- $act->content = sprintf(_("%1$s marked notice %2$s as a favorite."),
- $profile->getBestName(),
- $notice->uri);
+ if (empty($fav)) {
+ // That's weird.
+ return true;
+ }
- $act->actor = ActivityObject::fromProfile($profile);
- $act->object = ActivityObject::fromNotice($notice);
+ $act = $fav->asActivity();
$oprofile->notifyActivity($act, $profile);