Move AlreadyFulfilled check to Fave::addNew

This commit is contained in:
Mikael Nordfeldth
2015-03-10 11:50:16 +01:00
parent fa080328cf
commit 8a273eef20
5 changed files with 11 additions and 34 deletions

View File

@@ -14,17 +14,6 @@ class FavCommand extends Command
{
$notice = $this->getNotice($this->other);
$fave = new Fave();
$fave->user_id = $this->user->id;
$fave->notice_id = $notice->id;
$fave->find();
if ($fave->fetch()) {
// TRANS: Error message text shown when a favorite could not be set because it has already been favorited.
$channel->error($this->user, _('Could not create favorite: Already favorited.'));
return;
}
try {
$fave = Fave::addNew($this->user->getProfile(), $notice);
} catch (Exception $e) {