X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=plugins%2FFavorite%2Flib%2Ffavcommand.php;h=cf5ca79218ed293377555b7213ea2d92c37748a7;hb=c6b1b3e5e3ad1c47c7bd25b5bcfb0a8cb1cb2bb5;hp=c38463f4cd87f98997c3a431a6c616c617d69e89;hpb=fcdd061b4f89d04889025c516f98c9eead53ad1a;p=quix0rs-gnu-social.git diff --git a/plugins/Favorite/lib/favcommand.php b/plugins/Favorite/lib/favcommand.php index c38463f4cd..cf5ca79218 100644 --- a/plugins/Favorite/lib/favcommand.php +++ b/plugins/Favorite/lib/favcommand.php @@ -25,26 +25,12 @@ class FavCommand extends Command return; } - $fave = Fave::addNew($this->user->getProfile(), $notice); - - if (!$fave) { - // TRANS: Error message text shown when a favorite could not be set. - $channel->error($this->user, _('Could not create favorite.')); - return; - } - - // @fixme favorite notification should be triggered - // at a lower level - - $other = User::getKV('id', $notice->profile_id); - - if ($other && $other->id != $this->user->id) { - if ($other->email && $other->emailnotifyfav) { - mail_notify_fave($other, $this->user, $notice); - } - } - - $this->user->blowFavesCache(); + try { + $fave = Fave::addNew($this->user->getProfile(), $notice); + } catch (Exception $e) { + $channel->error($this->user, $e->getMessage()); + return; + } // TRANS: Text shown when a notice has been marked as favourite successfully. $channel->output($this->user, _('Notice marked as fave.'));