X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fatompubmembershipfeed.php;h=2ebd45bc8075c9ff889ced95df876c7baa1ab986;hb=56b07d84c53a03eacecc7794ddea127677f6a8e5;hp=57cf465a0c13373fa791dd89a45faf24b54da6a9;hpb=c0bb1a57984266024e8e5a968c0f3a3b54befff6;p=quix0rs-gnu-social.git diff --git a/actions/atompubmembershipfeed.php b/actions/atompubmembershipfeed.php index 57cf465a0c..2ebd45bc80 100644 --- a/actions/atompubmembershipfeed.php +++ b/actions/atompubmembershipfeed.php @@ -34,8 +34,6 @@ if (!defined('STATUSNET')) { exit(1); } -require_once INSTALLDIR . '/lib/apiauth.php'; - /** * Feed of group memberships for a user, in ActivityStreams format * @@ -64,7 +62,7 @@ class AtompubmembershipfeedAction extends ApiAuthAction $profileId = $this->trimmed('profile'); - $this->_profile = Profile::staticGet('id', $profileId); + $this->_profile = Profile::getKV('id', $profileId); if (empty($this->_profile)) { // TRANS: Client exception. @@ -141,12 +139,12 @@ class AtompubmembershipfeedAction extends ApiAuthAction // TRANS: Title for group membership feed. // TRANS: %s is a username. - $feed->setTitle(sprintf(_("%s group memberships"), + $feed->setTitle(sprintf(_('Group memberships of %s'), $this->_profile->getBestName())); // TRANS: Subtitle for group membership feed. // TRANS: %1$s is a username, %2$s is the StatusNet sitename. - $feed->setSubtitle(sprintf(_("Groups %1$s is a member of on %2$s"), + $feed->setSubtitle(sprintf(_('Groups %1$s is a member of on %2$s'), $this->_profile->getBestName(), common_config('site', 'name'))); @@ -237,21 +235,18 @@ class AtompubmembershipfeedAction extends ApiAuthAction if (Event::handle('StartAtomPubNewActivity', array(&$activity))) { if ($activity->verb != ActivityVerb::JOIN) { - // TRANS: Client error displayed when not using the POST verb. - // TRANS: Do not translate POST. + // TRANS: Client error displayed when not using the join verb. throw new ClientException(_('Can only handle join activities.')); - return; } $groupObj = $activity->objects[0]; if ($groupObj->type != ActivityObject::GROUP) { - // TRANS: Client exception thrown when trying favorite an object that is not a notice. - throw new ClientException(_('Can only fave notices.')); - return; + // TRANS: Client exception thrown when trying to join something which is not a group + throw new ClientException(_('Can only join groups.')); } - $group = User_group::staticGet('uri', $groupObj->id); + $group = User_group::getKV('uri', $groupObj->id); if (empty($group)) { // XXX: import from listed URL or something @@ -275,10 +270,7 @@ class AtompubmembershipfeedAction extends ApiAuthAction throw new ClientException(_('Blocked by admin.')); } - if (Event::handle('StartJoinGroup', array($group, $this->auth_user))) { - $membership = Group_member::join($group->id, $this->auth_user->id); - Event::handle('EndJoinGroup', array($group, $this->auth_user)); - } + $this->auth_user->joinGroup($group); Event::handle('EndAtomPubNewActivity', array($activity, $membership)); }