throw new AlreadyFulfilledException(_('You have already favorited this!'));
}
- $now = common_sql_now();
-
- $act = new Activity();
- $act->id = Fave::newUri($this->scoped, $this->target, $now);
- $act->type = Fave::getObjectType();
- $act->actor = $this->scoped->asActivityObject();
- $act->target = $this->target->asActivityObject();
- $act->objects = array(clone($act->target));
- $act->verb = ActivityVerb::FAVORITE;
- $act->title = ActivityUtils::verbToTitle($act->verb);
- $act->time = strtotime($now);
-
- $stored = Notice::saveActivity($act, $this->scoped,
- array('uri'=>$act->id));
-
- Fave::blowCacheForProfileId($this->scoped->id);
+ // throws exception on failure
+ $stored = Fave::addNew($this->scoped, $this->target);
return _('Favorited the notice');
}