diff options
-rw-r--r-- | Zotlabs/Lib/Activity.php | 6 | ||||
-rw-r--r-- | Zotlabs/Lib/Libzot.php | 3 | ||||
-rw-r--r-- | Zotlabs/Module/Item.php | 6 | ||||
-rw-r--r-- | include/items.php | 4 | ||||
-rw-r--r-- | view/tpl/jot.tpl | 4 |
5 files changed, 14 insertions, 9 deletions
diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php index d5620d7c6..8ff26389d 100644 --- a/Zotlabs/Lib/Activity.php +++ b/Zotlabs/Lib/Activity.php @@ -2306,6 +2306,8 @@ class Activity { if ($s['mid'] === $s['parent_mid']) { $s['item_thread_top'] = 1; + $s['item_nocomment'] = 0; + $s['comments_closed'] = NULL_DATE; // it is a parent node - decode the comment policy info if present if ($act->objprop('commentPolicy')) { @@ -2313,7 +2315,7 @@ class Activity { if ($until !== false) { $s['comments_closed'] = datetime_convert('UTC', 'UTC', substr($act->obj['commentPolicy'], $until + 6)); if ($s['comments_closed'] < datetime_convert()) { - $s['nocomment'] = true; + $s['item_nocomment'] = 1; } } @@ -3803,6 +3805,7 @@ class Activity { ->setPrivate($sourceItem['item_private']) ->setRestrict($sourceItem['item_restrict']) ->setNocomment($sourceItem['item_nocomment']) + ->setCommentsClosed($sourceItem['comments_closed']) ->setType($sourceItem['item_type']) ->setCommentPolicy($sourceItem['comment_policy']) ->setPublicPolicy($sourceItem['public_policy']) @@ -3810,6 +3813,7 @@ class Activity { } $result = post_activity_item($item->toArray(), deliver: $deliver, channel: $channel, observer: $channel, addAndSync: false); logger('addToCollection: ' . print_r($result, true)); + return $result; } diff --git a/Zotlabs/Lib/Libzot.php b/Zotlabs/Lib/Libzot.php index 1392656ab..f2fa78427 100644 --- a/Zotlabs/Lib/Libzot.php +++ b/Zotlabs/Lib/Libzot.php @@ -1294,6 +1294,7 @@ class Libzot { $item['item_private'] = 1; } +/* This is already managed in Activity::decode_note() if ($item['mid'] === $item['parent_mid']) { if (is_array($AS->obj) && array_key_exists('commentPolicy', $AS->obj)) { $p = strstr($AS->obj['commentPolicy'], 'until='); @@ -1312,7 +1313,7 @@ class Libzot { } } } - +*/ if (!empty($AS->meta['hubloc']) || $AS->sigok) { $item['item_verified'] = true; } diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php index 97ccb312e..06175109f 100644 --- a/Zotlabs/Module/Item.php +++ b/Zotlabs/Module/Item.php @@ -207,7 +207,6 @@ class Item extends Controller { $expires = NULL_DATE; - $comments_closed = NULL_DATE; $route = ''; $parent_item = null; @@ -454,7 +453,7 @@ class Item extends Controller { $title = escape_tags(trim($_REQUEST['title'])); $summary = escape_tags(trim($_REQUEST['summary'])); $body = trim($_REQUEST['body']); - $item_flags = $orig_post['item_flags']; + $item_flags = $orig_post['item_flags']; $item_origin = $orig_post['item_origin']; $item_unseen = $orig_post['item_unseen']; $item_starred = $orig_post['item_starred']; @@ -468,7 +467,7 @@ class Item extends Controller { $item_mentionsme = $orig_post['item_mentionsme']; $item_nocomment = $orig_post['item_nocomment']; $item_obscured = $orig_post['item_obscured']; - $item_verified = $orig_post['item_verified']; + $item_verified = $orig_post['item_verified']; $item_retained = $orig_post['item_retained']; $item_rss = $orig_post['item_rss']; $item_deleted = $orig_post['item_deleted']; @@ -793,6 +792,7 @@ class Item extends Controller { $item_origin = (($origin) ? 1 : 0); $item_consensus = (($consensus) ? 1 : 0); $item_nocomment = (($nocomment) ? 1 : 0); + $comments_closed = (($nocomment) ? $comments_closed : NULL_DATE); // determine if this is a wall post diff --git a/include/items.php b/include/items.php index 296a7f5c6..dbf7d104a 100644 --- a/include/items.php +++ b/include/items.php @@ -1842,7 +1842,7 @@ function item_store($arr, $allow_exec = false, $deliver = true, $addAndSync = tr ); } - if(comments_are_now_closed($r[0])) { + if(comments_are_now_closed($r[0]) && !in_array($arr['verb'], ['Add', 'Remove'])) { logger('item_store: comments closed'); $ret['message'] = 'Comments closed.'; return $ret; @@ -2230,7 +2230,7 @@ function item_store_update($arr, $allow_exec = false, $deliver = true, $addAndSy $arr['revision'] = ((x($arr,'revision') && $arr['revision'] > 0) ? intval($arr['revision']) : 0); - if(array_key_exists('comments_closed',$arr) && $arr['comments_closed'] > NULL_DATE) + if(array_key_exists('comments_closed',$arr)) $arr['comments_closed'] = datetime_convert('UTC','UTC',$arr['comments_closed']); else $arr['comments_closed'] = $orig[0]['comments_closed']; diff --git a/view/tpl/jot.tpl b/view/tpl/jot.tpl index 294750398..53315876b 100644 --- a/view/tpl/jot.tpl +++ b/view/tpl/jot.tpl @@ -169,7 +169,7 @@ </button> {{if $feature_nocomment}} <button type="button" id="profile-nocomment-wrapper" class="btn btn-outline-secondary btn-sm border-0" title="{{$nocommenttitle}}" onclick="toggleNoComment();return false;"> - <i id="profile-nocomment" class="bi bi-chat-dots jot-icons"></i> + <i id="profile-nocomment" class="bi{{if $nocomment}} bi-chat{{else}} bi-chat-dots{{/if}} jot-icons"></i> </button> {{/if}} {{if $custommoretoolsbuttons}} @@ -210,7 +210,7 @@ {{/if}} <a class="dropdown-item" href="#" onclick="initPoll(); return false"><i id="profile-poll" class="bi bi-bar-chart jot-icons"></i> {{$poll}}</a> {{if $feature_nocomment}} - <a class="dropdown-item" href="#" onclick="toggleNoComment(); return false;"><i id="profile-nocomment-sub" class="bi bi-chat"></i> {{$nocommenttitlesub}}</a> + <a class="dropdown-item" href="#" onclick="toggleNoComment(); return false;"><i id="profile-nocomment-sub" class="bi{{if $nocomment}} bi-chat{{else}} bi-chat-dots{{/if}}"></i> {{$nocommenttitlesub}}</a> {{/if}} <hr /> {{$custommoretoolsdropdown}} |