]> git.mxchange.org Git - friendica.git/commitdiff
Issue 9358: liking and commenting on the community page now gives a feedback
authorMichael <heluecht@pirati.ca>
Tue, 6 Oct 2020 05:18:54 +0000 (05:18 +0000)
committerMichael <heluecht@pirati.ca>
Tue, 6 Oct 2020 05:18:54 +0000 (05:18 +0000)
src/Module/Conversation/Community.php
view/templates/wall_thread.tpl
view/theme/frio/templates/threaded_conversation.tpl
view/theme/quattro/templates/threaded_conversation.tpl
view/theme/smoothly/templates/wall_thread.tpl
view/theme/vier/templates/threaded_conversation.tpl

index 24ee56f6c93f2d223ef1cf055ced3ebee80c4792..c8fd431ba1832e451ea95104499eb55dd1584c43 100644 (file)
@@ -46,6 +46,7 @@ class Community extends BaseModule
        protected static $itemsPerPage;
        protected static $since_id;
        protected static $max_id;
+       protected static $item_id;
 
        public static function content(array $parameters = [])
        {
@@ -258,6 +259,7 @@ class Community extends BaseModule
                self::$since_id = $_GET['since_id'] ?? null;
                self::$max_id   = $_GET['max_id']   ?? null;
                self::$max_id   = $_GET['last_commented'] ?? self::$max_id;
+               self::$item_id  = $_GET['item'] ?? null;
        }
 
        /**
@@ -271,7 +273,7 @@ class Community extends BaseModule
         */
        protected static function getItems()
        {
-               $items = self::selectItems(self::$since_id, self::$max_id, self::$itemsPerPage);
+               $items = self::selectItems(self::$since_id, self::$max_id, self::$item_id, self::$itemsPerPage);
 
                $maxpostperauthor = (int) DI::config()->get('system', 'max_author_posts_community_page');
                if ($maxpostperauthor != 0 && self::$content == 'local') {
@@ -303,7 +305,7 @@ class Community extends BaseModule
                                        self::$max_id = $items[count($items) - 1]['commented'];
                                }
 
-                               $items = self::selectItems(self::$since_id, self::$max_id, self::$itemsPerPage);
+                               $items = self::selectItems(self::$since_id, self::$max_id, self::$item_id, self::$itemsPerPage);
                        }
                } else {
                        $selected_items = $items;
@@ -322,7 +324,7 @@ class Community extends BaseModule
         * @throws \Exception
         * @TODO Move to repository/factory
         */
-       private static function selectItems($since_id, $max_id, $itemspage)
+       private static function selectItems($since_id, $max_id, $item_id, $itemspage)
        {
                $r = false;
 
@@ -342,19 +344,24 @@ class Community extends BaseModule
                        return [];
                }
 
-               if (local_user() && !empty($_REQUEST['no_sharer'])) {
-                       $condition[0] .= " AND NOT EXISTS (SELECT `uri-id` FROM `thread` AS t1 WHERE `t1`.`uri-id` = `thread`.`uri-id` AND `t1`.`uid` = ?)";
-                       $condition[] = local_user();
-               }
-
-               if (isset($max_id)) {
-                       $condition[0] .= " AND `commented` < ?";
-                       $condition[] = $max_id;
-               }
+               if (isset($item_id)) {
+                       $condition[0] .= " AND `iid` = ?";
+                       $condition[] = $item_id;
+               } else {
+                       if (local_user() && !empty($_REQUEST['no_sharer'])) {
+                               $condition[0] .= " AND NOT EXISTS (SELECT `uri-id` FROM `thread` AS t1 WHERE `t1`.`uri-id` = `thread`.`uri-id` AND `t1`.`uid` = ?)";
+                               $condition[] = local_user();
+                       }
+       
+                       if (isset($max_id)) {
+                               $condition[0] .= " AND `commented` < ?";
+                               $condition[] = $max_id;
+                       }
 
-               if (isset($since_id)) {
-                       $condition[0] .= " AND `commented` > ?";
-                       $condition[] = $since_id;
+                       if (isset($since_id)) {
+                               $condition[0] .= " AND `commented` > ?";
+                               $condition[] = $since_id;
+                       }
                }
 
                $r = Item::selectThreadForUser(0, ['uri', 'commented', 'author-link'], $condition, ['order' => ['commented' => true], 'limit' => $itemspage]);
index 73e99cb1bddcd79c520ff6a11822a6825ad20802..b869b996d796e05a17f28d17e742acc9c89e6cda 100644 (file)
@@ -16,7 +16,7 @@
 <span class="created" style="display: none;">{{$item.created_date}}</span>
 <span class="uriid" style="display: none;">{{$item.uriid}}</span>
 {{/if}}
-<div id="tread-wrapper-{{$item.id}}" class="tread-wrapper {{$item.toplevel}} {{if $item.toplevel}} h-entry {{else}} u-comment h-cite {{/if}}">
+<div id="tread-wrapper-{{$item.uriid}}" class="tread-wrapper {{$item.toplevel}} {{if $item.toplevel}} h-entry {{else}} u-comment h-cite {{/if}}">
 <a name="{{$item.id}}" ></a>
 <div class="wall-item-outside-wrapper {{$item.indent}}{{$item.previewing}}{{if $item.owner_url}} wallwall{{/if}}" id="wall-item-outside-wrapper-{{$item.id}}" >
        <div class="wall-item-content-wrapper {{$item.indent}} {{$item.shiny}}" id="wall-item-content-wrapper-{{$item.id}}" >
index b1039d94730203980054c57179647e261be70b41..f618da2817b6aa7cc41dcaf7a33dc4c4f23aed26 100644 (file)
@@ -5,7 +5,7 @@
 
 {{foreach $threads as $thread}}
 <hr class="sr-only" />
-<div id="tread-wrapper-{{$thread.id}}" class="tread-wrapper {{if $thread.threaded}}threaded{{/if}} {{$thread.toplevel}} {{$thread.network}} {{if $thread.thread_level==1}}panel-default panel{{/if}} {{if $thread.thread_level!=1}}comment-wrapper{{/if}}" style="{{if $item.thread_level>2}}margin-left: -15px; margin-right:-16px; margin-bottom:-16px;{{/if}}"><!-- panel -->
+<div id="tread-wrapper-{{$thread.uriid}}" class="tread-wrapper {{if $thread.threaded}}threaded{{/if}} {{$thread.toplevel}} {{$thread.network}} {{if $thread.thread_level==1}}panel-default panel{{/if}} {{if $thread.thread_level!=1}}comment-wrapper{{/if}}" style="{{if $item.thread_level>2}}margin-left: -15px; margin-right:-16px; margin-bottom:-16px;{{/if}}"><!-- panel -->
 
                {{* {{if $thread.type == tag}}
                        {{include file="wall_item_tag.tpl" item=$thread}}
index 0d90db1860c06a704c9c8e947d511e08499c9494..33431361f6dfea82078c1289150b464ce8039d83 100644 (file)
@@ -2,7 +2,7 @@
 
 {{foreach $threads as $thread}}
 
-<div id="tread-wrapper-{{$thread.id}}" class="tread-wrapper {{if $thread.threaded}}threaded{{/if}}  {{$thread.toplevel}} {{if $thread.toplevel}} h-entry  {{else}} u-comment h-cite {{/if}} {{$thread.network}}">
+<div id="tread-wrapper-{{$thread.uriid}}" class="tread-wrapper {{if $thread.threaded}}threaded{{/if}}  {{$thread.toplevel}} {{if $thread.toplevel}} h-entry  {{else}} u-comment h-cite {{/if}} {{$thread.network}}">
 
 
                {{if $thread.type == tag}}
index c9f258f6fdcb45d153b2759f7cbcc7f4188ef81e..2e83a248207c4dca540ddc952091183995cce18a 100644 (file)
@@ -11,7 +11,7 @@
        <div id="collapsed-comments-{{$item.id}}" class="collapsed-comments" style="display: none;">
 {{/if}}
 
-<div id="tread-wrapper-{{$item.id}}" class="tread-wrapper {{$item.toplevel}} {{if $item.toplevel}} h-entry {{else}} u-comment h-cite {{/if}}">
+<div id="tread-wrapper-{{$item.uriid}}" class="tread-wrapper {{$item.toplevel}} {{if $item.toplevel}} h-entry {{else}} u-comment h-cite {{/if}}">
 <div class="wall-item-outside-wrapper {{$item.indent}} {{$item.shiny}} wallwall" id="wall-item-outside-wrapper-{{$item.id}}" >
 <div class="wall-item-content-wrapper {{$item.indent}} {{$item.shiny}}" id="wall-item-content-wrapper-{{$item.id}}" >
 
index 885a508fa9ea01e6be7a9e6f772f3e44f679c452..35807f99120011a174b753551ff405980e619593 100644 (file)
@@ -2,7 +2,7 @@
 
 {{foreach $threads as $thread}}
 <hr class="sr-only" />
-<div id="tread-wrapper-{{$thread.id}}" class="tread-wrapper {{if $thread.threaded}}threaded{{/if}}  {{$thread.toplevel}} {{if $thread.toplevel}}h-entry{{/if}} {{$thread.network}}">
+<div id="tread-wrapper-{{$thread.uriid}}" class="tread-wrapper {{if $thread.threaded}}threaded{{/if}}  {{$thread.toplevel}} {{if $thread.toplevel}}h-entry{{/if}} {{$thread.network}}">
        
        
                {{if $thread.type == tag}}