*
* @return void
*/
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
$notice = Notice::getKV($id);
$token = $this->checkSessionToken();
- if (Fave::existsForProfile($notice, $profile)) {
- // TRANS: Client error.
- throw new AlreadyFulfilledException(_m('This notice is already a favorite!'));
- }
- $fave = Fave::addNew($profile, $notice);
-
- if (!$fave instanceof Fave) {
- // TRANS: Server error.
- $this->serverError(_m('Could not create favorite.'));
- }
-
- Fave::blowCacheForProfileId($profile->id);
+ // Throws exception
+ $stored = Fave::addNew($profile, $notice);
if ($this->boolean('ajax')) {
$this->startHTML('text/xml;charset=utf-8');