]> git.mxchange.org Git - friendica.git/commitdiff
Update the "commented" field only on several verbs
authorMichael <heluecht@pirati.ca>
Mon, 5 Oct 2020 17:57:24 +0000 (17:57 +0000)
committerMichael <heluecht@pirati.ca>
Mon, 5 Oct 2020 17:57:24 +0000 (17:57 +0000)
src/Model/Item.php

index dfea296815a94229bc07e8ad9f16a6968f468ffe..f47e5feec0029a34cdb977658f549c003c1e04d0 100644 (file)
@@ -1828,8 +1828,6 @@ class Item
                        $notify_type = Delivery::POST;
                }
 
-               $like_no_comment = DI::config()->get('system', 'like_no_comment');
-
                DBA::transaction();
 
                if (!in_array($item['verb'], self::ACTIVITIES)) {
@@ -1940,8 +1938,15 @@ class Item
                $item['parent'] = $parent_id;
 
                // update the commented timestamp on the parent
-               // Only update "commented" if it is really a comment
-               if (($item['gravity'] != GRAVITY_ACTIVITY) || !$like_no_comment) {
+               if (DI::config()->get('system', 'like_no_comment')) {
+                       // Update when it is a comment
+                       $update_commented = in_array($item['gravity'], [GRAVITY_PARENT, GRAVITY_COMMENT]);
+               } else {
+                       // Update when it isn't a follow or tag verb
+                       $update_commented = !in_array($item['verb'], [Activity::FOLLOW, Activity::TAG]);
+               }
+
+               if ($update_commented) {
                        DBA::update('item', ['commented' => DateTimeFormat::utcNow(), 'changed' => DateTimeFormat::utcNow()], ['id' => $parent_id]);
                } else {
                        DBA::update('item', ['changed' => DateTimeFormat::utcNow()], ['id' => $parent_id]);