]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Merge branch 'testing' of git@gitorious.org:statusnet/mainline into testing
authorEvan Prodromou <evan@status.net>
Sun, 21 Feb 2010 01:27:04 +0000 (20:27 -0500)
committerEvan Prodromou <evan@status.net>
Sun, 21 Feb 2010 01:27:04 +0000 (20:27 -0500)
Conflicts:
plugins/OStatus/OStatusPlugin.php

1  2 
plugins/OStatus/OStatusPlugin.php

index 98e048c14c0c2d2c3e106621b03c636eafaca285,4cbf78e638740d41ecd3ff77516be630d5c4a615..5081c4d983fc1340ad60de7894ff61d8323273a4
@@@ -255,7 -255,7 +255,7 @@@ class OStatusPlugin extends Plugi
      {
          if ($user instanceof Profile) {
              $profile = $user;
 -        } else if ($user instanceof Profile) {
 +        } else if ($user instanceof User) {
              $profile = $user->getProfile();
          }
          $oprofile = Ostatus_profile::staticGet('profile_id', $other->id);
          // We have a local user subscribing to a remote profile; make the
          // magic happen!
  
 -        $oprofile->notify($subscriber, ActivityVerb::FOLLOW);
 +        $oprofile->notify($subscriber, ActivityVerb::FOLLOW, $oprofile);
  
          return true;
      }
  
-     function onEndFavor($profile, $notice)
+     /**
+      * Notify remote users when their notices get favorited.
+      *
+      * @param Profile or User $profile of local user doing the faving
+      * @param Notice $notice being favored
+      * @return hook return value
+      */
+     function onEndFavorNotice($profile, Notice $notice)
      {
-         // is the favorer a local user?
-         $user = User::staticGet('id', $profile->id);
-         if (empty($user)) {
-             return true;
+         if ($profile instanceof User) {
+             // @fixme upstream function should clarify its parameters
+             $profile = $profile->getProfile();
          }
-         // is the author an OStatus remote user?
          $oprofile = Ostatus_profile::staticGet('profile_id', $notice->profile_id);
-         if (empty($oprofile)) {
-             return true;
+         if ($oprofile) {
+             $oprofile->notify($profile, ActivityVerb::FAVORITE, $notice);
          }
-         // Local user faved an Ostatus profile's notice; notify them!
-         $obj = ActivityObject::fromNotice($notice);
-         $oprofile->notify($profile,
-                           ActivityVerb::FAVORITE,
-                           $obj->asString());
-         return true;
      }
  
-     function onEndDisfavor($profile, $notice)
+     /**
+      * Notify remote users when their notices get de-favorited.
+      *
+      * @param Profile or User $profile of local user doing the de-faving
+      * @param Notice $notice being favored
+      * @return hook return value
+      */
+     function onEndDisfavorNotice(Profile $profile, Notice $notice)
      {
-         // is the favorer a local user?
-         $user = User::staticGet('id', $profile->id);
-         if (empty($user)) {
-             return true;
-         }
-         // is the author an OStatus remote user?
          $oprofile = Ostatus_profile::staticGet('profile_id', $notice->profile_id);
-         if (empty($oprofile)) {
-             return true;
+         if ($oprofile) {
+             $oprofile->notify($profile, ActivityVerb::UNFAVORITE, $notice);
          }
-         // Local user faved an Ostatus profile's notice; notify them!
-         $obj = ActivityObject::fromNotice($notice);
-         $oprofile->notify($profile,
-                           ActivityVerb::UNFAVORITE,
-                           $obj->asString());
-         return true;
      }
  }