X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fatompubshowmembership.php;h=ad6aa6c1d05db3bf00bf0ec3bff912a01a27235a;hb=cd6fa512ac0d382871384a9c7604abd8a7ed0566;hp=4454c7fd7ad0f9ee80488fe823d04144e335b2ba;hpb=6455461c196fcb8e7c0047870d480e4a97986709;p=quix0rs-gnu-social.git diff --git a/actions/atompubshowmembership.php b/actions/atompubshowmembership.php index 4454c7fd7a..ad6aa6c1d0 100644 --- a/actions/atompubshowmembership.php +++ b/actions/atompubshowmembership.php @@ -34,8 +34,6 @@ if (!defined('STATUSNET')) { exit(1); } -require_once INSTALLDIR . '/lib/apiauth.php'; - /** * Show (or delete) a single membership event as an ActivityStreams entry * @@ -65,7 +63,7 @@ class AtompubshowmembershipAction 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. @@ -74,11 +72,11 @@ class AtompubshowmembershipAction extends ApiAuthAction $groupId = $this->trimmed('group'); - $this->_group = User_group::staticGet('id', $groupId); + $this->_group = User_group::getKV('id', $groupId); if (empty($this->_group)) { // TRANS: Client exception thrown when referencing a non-existing group. - throw new ClientException(_('No such group'), 404); + throw new ClientException(_('No such group.'), 404); } $kv = array('group_id' => $groupId, @@ -88,7 +86,7 @@ class AtompubshowmembershipAction extends ApiAuthAction if (empty($this->_membership)) { // TRANS: Client exception thrown when trying to show membership of a non-subscribed group - throw new ClientException(_('Not a member'), 404); + throw new ClientException(_('Not a member.'), 404); } return true; @@ -113,7 +111,7 @@ class AtompubshowmembershipAction extends ApiAuthAction break; default: // TRANS: Client exception thrown when using an unsupported HTTP method. - throw new ClientException(_('HTTP method not supported'), 405); + throw new ClientException(_('HTTP method not supported.'), 405); break; } return; @@ -142,20 +140,16 @@ class AtompubshowmembershipAction extends ApiAuthAction * * @return void */ - function deleteMembership() { if (empty($this->auth_user) || $this->auth_user->id != $this->_profile->id) { // TRANS: Client exception thrown when deleting someone else's membership. throw new ClientException(_("Cannot delete someone else's". - " membership"), 403); + " membership."), 403); } - if (Event::handle('StartLeaveGroup', array($this->_group, $this->auth_user))) { - Group_member::leave($this->_group->id, $this->auth_user->id); - Event::handle('EndLeaveGroup', array($this->_group, $this->auth_user)); - } + $this->auth_user->leaveGroup($this->_group); return; }