]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/Favorite/FavoritePlugin.php
Merge branch 'master' into mmn_fixes
[quix0rs-gnu-social.git] / plugins / Favorite / FavoritePlugin.php
index f298fc3e928b8fca1a20c642569f4f863bac550f..d3a3fa86f723ad378be45fae1109328fc54ebb94 100644 (file)
@@ -96,7 +96,7 @@ class FavoritePlugin extends ActivityVerbHandlerPlugin
                                          '    modified = "%s" '.
                                          'WHERE user_id = %d '.
                                          'AND notice_id = %d',
-                                         Fave::newUri($fave->user_id, $fave->notice_id, $fave->modified),
+                                         Fave::newUri($fave->getActor(), $fave->getTarget(), $fave->modified),
                                          common_sql_date(strtotime($fave->modified)),
                                          $fave->user_id,
                                          $fave->notice_id));
@@ -185,15 +185,11 @@ class FavoritePlugin extends ActivityVerbHandlerPlugin
     {
         assert($this->isMyActivity($act));
 
-        // If empty, we should've created it ourselves on our node.
-        if (!isset($options['created'])) {
-            $options['created'] = !empty($act->time) ? common_sql_date($act->time) : common_sql_now();
-        }
-
         // We must have an objects[0] here because in isMyActivity we require the count to be == 1
         $actobj = $act->objects[0];
 
         $object = Fave::saveActivityObject($actobj, $stored);
+
         return $object;
     }
 
@@ -206,7 +202,6 @@ class FavoritePlugin extends ActivityVerbHandlerPlugin
             return true;
         }
 
-        common_debug('Extending activity '.$stored->id.' with '.get_called_class());
         $this->extendActivity($stored, $act, $scoped);
         return false;
     }
@@ -330,7 +325,7 @@ class FavoritePlugin extends ActivityVerbHandlerPlugin
         }
     }
 
-    public function showNoticeListItem(NoticeListItem $nli)
+    protected function showNoticeListItem(NoticeListItem $nli)
     {
         // pass
     }
@@ -361,7 +356,7 @@ class FavoritePlugin extends ActivityVerbHandlerPlugin
         return true;
     }
 
-    public function onStartShowThreadedNoticeTailItems(NoticeListItem $nli, Notice $notice, &$threadActive)
+    public function onEndShowThreadedNoticeTailItems(NoticeListItem $nli, Notice $notice, &$threadActive)
     {
         if ($nli instanceof ThreadedNoticeListSubItem) {
             // The sub-items are replies to a conversation, thus we use different HTML elements etc.
@@ -525,8 +520,8 @@ class FavoritePlugin extends ActivityVerbHandlerPlugin
         $expected_verb = $exists ? ActivityVerb::UNFAVORITE : ActivityVerb::FAVORITE;
 
         switch (true) {
-        case $exists && ActivityUtils::compareTypes($verb, array(ActivityVerb::FAVORITE, ActivityVerb::LIKE)):
-        case !$exists && ActivityUtils::compareTypes($verb, array(ActivityVerb::UNFAVORITE, ActivityVerb::UNLIKE)):
+        case $exists && ActivityUtils::compareVerbs($verb, array(ActivityVerb::FAVORITE, ActivityVerb::LIKE)):
+        case !$exists && ActivityUtils::compareVerbs($verb, array(ActivityVerb::UNFAVORITE, ActivityVerb::UNLIKE)):
             common_redirect(common_local_url('activityverb',
                                 array('id'   => $target->getID(),
                                       'verb' => ActivityUtils::resolveUri($expected_verb, true))));
@@ -541,10 +536,10 @@ class FavoritePlugin extends ActivityVerbHandlerPlugin
     protected function doActionPost(ManagedAction $action, $verb, Notice $target, Profile $scoped)
     {
         switch (true) {
-        case ActivityUtils::compareTypes($verb, array(ActivityVerb::FAVORITE, ActivityVerb::LIKE)):
+        case ActivityUtils::compareVerbs($verb, array(ActivityVerb::FAVORITE, ActivityVerb::LIKE)):
             Fave::addNew($scoped, $target);
             break;
-        case ActivityUtils::compareTypes($verb, array(ActivityVerb::UNFAVORITE, ActivityVerb::UNLIKE)):
+        case ActivityUtils::compareVerbs($verb, array(ActivityVerb::UNFAVORITE, ActivityVerb::UNLIKE)):
             Fave::removeEntry($scoped, $target);
             break;
         default: