3 class FavCommand extends Command
7 function __construct($user, $other)
9 parent::__construct($user);
10 $this->other = $other;
13 function handle($channel)
15 $notice = $this->getNotice($this->other);
18 $fave->user_id = $this->user->id;
19 $fave->notice_id = $notice->id;
23 // TRANS: Error message text shown when a favorite could not be set because it has already been favorited.
24 $channel->error($this->user, _('Could not create favorite: Already favorited.'));
29 $fave = Fave::addNew($this->user->getProfile(), $notice);
30 } catch (Exception $e) {
31 $channel->error($this->user, $e->getMessage());
35 // TRANS: Text shown when a notice has been marked as favourite successfully.
36 $channel->output($this->user, _('Notice marked as fave.'));