Found some unreachable code in Favorite

The portion after StartAtomPubNewActivity would never be reached since
Favorite handles that activity through ActivityHandlerPlugin nowadays.
So I cleaned it up and followed a couple of paths, making stuff prettier.
This commit is contained in:
Mikael Nordfeldth
2015-01-12 02:23:23 +01:00
parent 73669ed308
commit aca5ff1b23
5 changed files with 38 additions and 123 deletions

View File

@@ -25,13 +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;
}
try {
$fave = Fave::addNew($this->user->getProfile(), $notice);
} catch (Exception $e) {
$channel->error($this->user, $e->getMessage());
return;
}
// @fixme favorite notification should be triggered
// at a lower level