]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/Favorite/actions/favor.php
Merge branch 'master' of gitorious.org:social/mainline
[quix0rs-gnu-social.git] / plugins / Favorite / actions / favor.php
index a7f0cd7fb26b7b1d8a173568f3b63629d321d506..d1c9df34f5ff590e35a3245d608d6dc136a48fba 100644 (file)
@@ -74,22 +74,8 @@ class FavorAction extends FormAction
             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');
     }