X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=plugins%2FFavorite%2Factions%2Fapifavoritecreate.php;fp=plugins%2FFavorite%2Factions%2Fapifavoritecreate.php;h=7e63b199e2285a9fd77327816a40a2a7dbe0c51d;hb=8a273eef2078d77faad027ce46a4cfca0ada8225;hp=736bd7b0a19eaa720cf49040bd9255912f9c4afa;hpb=fa080328cfd85ca61711bcf8a71995895a2fada1;p=quix0rs-gnu-social.git diff --git a/plugins/Favorite/actions/apifavoritecreate.php b/plugins/Favorite/actions/apifavoritecreate.php index 736bd7b0a1..7e63b199e2 100644 --- a/plugins/Favorite/actions/apifavoritecreate.php +++ b/plugins/Favorite/actions/apifavoritecreate.php @@ -89,20 +89,13 @@ class ApiFavoriteCreateAction extends ApiAuthAction ); } - // Note: Twitter lets you fave things repeatedly via API. - - if (Fave::existsForProfile($this->notice, $this->scoped)) { - $this->clientError( - // TRANS: Client error displayed when trying to mark a notice favourite that already is a favourite. - _('This status is already a favorite.'), - 403, - $this->format - ); + try { + $stored = Fave::addNew($this->scoped, $this->notice); + } catch (AlreadyFulfilledException $e) { + // Note: Twitter lets you fave things repeatedly via API. + $this->clientError($e->getMessage(), 403); } - // throws exception on failure - $stored = Fave::addNew($this->scoped, $this->notice); - if ($this->format == 'xml') { $this->showSingleXmlStatus($this->notice); } elseif ($this->format == 'json') {