X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=plugins%2FSubMirror%2Factions%2Feditmirror.php;h=557eb0aba47d3ba123c69830b45a483c9edb9450;hb=f519858044a627e99244b334b7bef3f7f96fa317;hp=7ddd32ef359a327cbabb031d3c575a4a1bf5aa9a;hpb=300ed65d301d21c33a5f0a196d6acfe762a34f29;p=quix0rs-gnu-social.git diff --git a/plugins/SubMirror/actions/editmirror.php b/plugins/SubMirror/actions/editmirror.php index 7ddd32ef35..557eb0aba4 100644 --- a/plugins/SubMirror/actions/editmirror.php +++ b/plugins/SubMirror/actions/editmirror.php @@ -45,10 +45,8 @@ if (!defined('STATUSNET')) { * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPLv3 * @link http://status.net/ */ - -class EditMirrorAction extends AddMirrorAction +class EditMirrorAction extends BaseMirrorAction { - /** * Check pre-requisites and instantiate attributes * @@ -56,15 +54,18 @@ class EditMirrorAction extends AddMirrorAction * * @return boolean success flag */ - function prepare($args) { parent::prepare($args); + + $this->profile = $this->validateProfile($this->trimmed('profile')); + $this->mirror = SubMirror::pkeyGet(array('subscriber' => $this->user->id, 'subscribed' => $this->profile->id)); if (!$this->mirror) { - $this->clientError(_m("Requested invalid profile to edit.")); + // TRANS: Client error displayed when trying to edit an object that is not a feed mirror. + $this->clientError(_m('Requested invalid profile to edit.')); } $this->style = $this->validateStyle($this->trimmed('style')); @@ -82,7 +83,8 @@ class EditMirrorAction extends AddMirrorAction if (in_array($style, $allowed)) { return $style; } else { - $this->clientError(_m("Bad form data.")); + // TRANS: Client error displayed when providing invalid input when editing a mirror. + $this->clientError(_m('Bad form data.')); } } @@ -90,11 +92,16 @@ class EditMirrorAction extends AddMirrorAction { $mirror = SubMirror::getMirror($this->user, $this->profile); if (!$mirror) { - $this->clientError(_m('Requested edit of missing mirror')); + // TRANS: Client error thrown when a mirror request is made and no result is retrieved. + $this->clientError(_m('The mirror request failed, because no result was retrieved.')); } if ($this->delete) { $mirror->delete(); + $oprofile = Ostatus_profile::staticGet('profile_id', $this->profile->id); + if ($oprofile) { + $oprofile->garbageCollect(); + } } else if ($this->style != $mirror->style) { $orig = clone($mirror); $mirror->style = $this->style;