X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=plugins%2FFavorite%2Factions%2Fapifavoritecreate.php;h=7ff8f391b2466309df4d109866c1e16df438cf49;hb=d6b28c64830f632bb2f4b6f3c9369b9e56ad217a;hp=8a273740534c639b6f681a78cbd2677681b23c2f;hpb=f8e7d426530e02fd10c6756668c6338a01f78a4b;p=quix0rs-gnu-social.git diff --git a/plugins/Favorite/actions/apifavoritecreate.php b/plugins/Favorite/actions/apifavoritecreate.php index 8a27374053..7ff8f391b2 100644 --- a/plugins/Favorite/actions/apifavoritecreate.php +++ b/plugins/Favorite/actions/apifavoritecreate.php @@ -101,20 +101,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') {