]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Merge branch 'master' into testing
authorEvan Prodromou <evan@status.net>
Mon, 30 May 2011 15:18:22 +0000 (11:18 -0400)
committerEvan Prodromou <evan@status.net>
Mon, 30 May 2011 15:18:22 +0000 (11:18 -0400)
1  2 
lib/activityimporter.php

diff --combined lib/activityimporter.php
index da6fc5e321d855fe04d125171d80912b280e271f,b5c83516ec0fd26296c89e2ff9ecc8269a56f625..096eb9ba435c268082312270db195dcd0c75681b
@@@ -63,9 -63,9 +63,9 @@@ class ActivityImporter extends QueueHan
  
          $done = null;
  
-         if (Event::handle('StartImportActivity',
-                           array($user, $author, $activity, $trusted, &$done))) {
-             try {
+         try {
+             if (Event::handle('StartImportActivity',
+                               array($user, $author, $activity, $trusted, &$done))) {
                  switch ($activity->verb) {
                  case ActivityVerb::FOLLOW:
                      $this->subscribeProfile($user, $author, $activity);
                  Event::handle('EndImportActivity',
                                array($user, $author, $activity, $trusted));
                  $done = true;
-             } catch (Exception $e) {
-                 common_log(LOG_ERR, $e->getMessage());
-                 $done = true;
              }
+         } catch (Exception $e) {
+             common_log(LOG_ERR, $e->getMessage());
+             $done = true;
          }
          return $done;
      }
@@@ -98,7 -98,7 +98,7 @@@
          if ($activity->objects[0]->id == $author->id) {
              if (!$this->trusted) {
                  // TRANS: Client exception thrown when trying to force a subscription for an untrusted user.
 -                throw new ClientException(_("Cannot force subscription for untrusted user."));
 +                throw new ClientException(_('Cannot force subscription for untrusted user.'));
              }
  
              $other = $activity->actor;
              if (!empty($otherUser)) {
                  $otherProfile = $otherUser->getProfile();
              } else {
 -                // TRANS: Client exception thrown when trying to for a remote user to subscribe.
 -                throw new Exception(_("Cannot force remote user to subscribe."));
 +                // TRANS: Client exception thrown when trying to force a remote user to subscribe.
 +                throw new Exception(_('Cannot force remote user to subscribe.'));
              }
  
              // XXX: don't do this for untrusted input!
  
              if (empty($otherProfile)) {
                  // TRANS: Client exception thrown when trying to subscribe to an unknown profile.
 -                throw new ClientException(_("Unknown profile."));
 +                throw new ClientException(_('Unknown profile.'));
              }
  
              Subscription::start($profile, $otherProfile);
          } else {
              // TRANS: Client exception thrown when trying to import an event not related to the importing user.
 -            throw new Exception(_("This activity seems unrelated to our user."));
 +            throw new Exception(_('This activity seems unrelated to our user.'));
          }
      }
  
              $oprofile = Ostatus_profile::ensureActivityObjectProfile($activity->objects[0]);
              if (!$oprofile->isGroup()) {
                  // TRANS: Client exception thrown when trying to join a remote group that is not a group.
 -                throw new ClientException(_("Remote profile is not a group!"));
 +                throw new ClientException(_('Remote profile is not a group!'));
              }
              $group = $oprofile->localGroup();
          }
              throw new ClientException(_("User is already a member of this group."));
          }
  
 -        if (Event::handle('StartJoinGroup', array($group, $user))) {
 -            Group_member::join($group->id, $user->id);
 -            Event::handle('EndJoinGroup', array($group, $user));
 -        }
 +        $user->joinGroup($group);
      }
  
      // XXX: largely cadged from Ostatus_profile::processNote()
                  }
              } else {
                  // TRANS: Client exception thrown when trying to overwrite the author information for a non-trusted user during import.
 -                throw new ClientException(_("Not overwriting author info for non-trusted user."));
 +                throw new ClientException(_('Not overwriting author info for non-trusted user.'));
              }
          }
  
              // @fixme fetch from $sourceUrl?
              // TRANS: Client exception thrown when trying to import a notice without content.
              // TRANS: %s is the notice URI.
 -            throw new ClientException(sprintf(_("No content for notice %s."),$sourceUri));
 +            throw new ClientException(sprintf(_('No content for notice %s.'),$sourceUri));
          }
  
          // Get (safe!) HTML and text versions of the content