]> git.mxchange.org Git - friendica.git/commitdiff
Optionally display the resharer as icon
authorMichael <heluecht@pirati.ca>
Wed, 26 Aug 2020 12:33:17 +0000 (12:33 +0000)
committerMichael <heluecht@pirati.ca>
Wed, 26 Aug 2020 12:33:17 +0000 (12:33 +0000)
include/conversation.php
src/Module/Settings/Display.php
static/settings.config.php
view/templates/settings/display.tpl
view/theme/frio/templates/settings/display.tpl

index 7ff4de2ead7b447ffd6d963f522aa4b78f566be0..c668e53d9da656d3549c6328d54f7c86f6d0510f 100644 (file)
@@ -711,6 +711,7 @@ function conversation_fetch_comments($thread_items, $pinned) {
        $parentlines = [];
        $lineno = 0;
        $direction = [];
+       $actor = [];
        $received = '';
 
        while ($row = Item::fetch($thread_items)) {
@@ -718,6 +719,7 @@ function conversation_fetch_comments($thread_items, $pinned) {
                        && ($row['thr-parent'] == $row['parent-uri']) && ($row['received'] > $received)
                        && Contact::isSharing($row['author-id'], $row['uid'])) {
                        $direction = ['direction' => 3, 'title' => DI::l10n()->t('%s reshared this.', $row['author-name'])];
+                       $actor = ['link' => $row['author-link'], 'avatar' => $row['author-avatar'], 'name' => $row['author-name']];
                        $received = $row['received'];
                }
 
@@ -748,6 +750,11 @@ function conversation_fetch_comments($thread_items, $pinned) {
        if (!empty($direction)) {
                foreach ($parentlines as $line) {
                        $comments[$line]['direction'] = $direction;
+                       if (!empty($actor) && DI::pConfig()->get(local_user(), 'system', 'display_resharer')  ) {
+                               $comments[$line]['owner-link'] = $actor['link'];
+                               $comments[$line]['owner-avatar'] = $actor['avatar'];
+                               $comments[$line]['owner-name'] = $actor['name'];
+                       }
                }
        }
        return $comments;
index bde049718d9377824a20c866c27987cb0e16e3f2..443385394022390d3265f10605e44189d35590c7 100644 (file)
@@ -52,6 +52,7 @@ class Display extends BaseSettings
                $no_auto_update     = !empty($_POST['no_auto_update'])     ? intval($_POST['no_auto_update'])     : 0;
                $no_smart_threading = !empty($_POST['no_smart_threading']) ? intval($_POST['no_smart_threading']) : 0;
                $hide_dislike       = !empty($_POST['hide_dislike'])       ? intval($_POST['hide_dislike'])       : 0;
+               $display_resharer   = !empty($_POST['display_resharer'])   ? intval($_POST['display_resharer'])   : 0;
                $browser_update     = !empty($_POST['browser_update'])     ? intval($_POST['browser_update'])     : 0;
                if ($browser_update != -1) {
                        $browser_update = $browser_update * 1000;
@@ -85,6 +86,7 @@ class Display extends BaseSettings
                DI::pConfig()->set(local_user(), 'system', 'infinite_scroll'         , $infinite_scroll);
                DI::pConfig()->set(local_user(), 'system', 'no_smart_threading'      , $no_smart_threading);
                DI::pConfig()->set(local_user(), 'system', 'hide_dislike'            , $hide_dislike);
+               DI::pConfig()->set(local_user(), 'system', 'display_resharer'        , $display_resharer);
                DI::pConfig()->set(local_user(), 'system', 'first_day_of_week'       , $first_day_of_week);
 
                if (in_array($theme, Theme::getAllowedList())) {
@@ -166,6 +168,7 @@ class Display extends BaseSettings
                $infinite_scroll    = DI::pConfig()->get(local_user(), 'system', 'infinite_scroll', 0);
                $no_smart_threading = DI::pConfig()->get(local_user(), 'system', 'no_smart_threading', 0);
                $hide_dislike       = DI::pConfig()->get(local_user(), 'system', 'hide_dislike', 0);
+               $display_resharer   = DI::pConfig()->get(local_user(), 'system', 'display_resharer', 0);
 
                $first_day_of_week = DI::pConfig()->get(local_user(), 'system', 'first_day_of_week', 0);
                $weekdays = [0 => DI::l10n()->t("Sunday"), 1 => DI::l10n()->t("Monday")];
@@ -202,6 +205,7 @@ class Display extends BaseSettings
                        '$infinite_scroll'          => ['infinite_scroll'         , DI::l10n()->t('Infinite scroll'), $infinite_scroll, DI::l10n()->t('Automatic fetch new items when reaching the page end.')],
                        '$no_smart_threading'       => ['no_smart_threading'      , DI::l10n()->t('Disable Smart Threading'), $no_smart_threading, DI::l10n()->t('Disable the automatic suppression of extraneous thread indentation.')],
                        '$hide_dislike'             => ['hide_dislike'            , DI::l10n()->t('Hide the Dislike feature'), $hide_dislike, DI::l10n()->t('Hides the Dislike button and dislike reactions on posts and comments.')],
+                       '$display_resharer'         => ['display_resharer'        , DI::l10n()->t('Display the resharer'), $display_resharer, DI::l10n()->t('Display the first resharer as icon and text on a reshared item.')],
 
                        '$first_day_of_week' => ['first_day_of_week', DI::l10n()->t('Beginning of week:'), $first_day_of_week, '', $weekdays, false],
                ]);
index 19f47d2b8a36b86ccc4a5d28751599dbf9aef28f..9c4e739f08b56d5d5619ff7aeda50ca07c85adba 100644 (file)
@@ -150,6 +150,10 @@ return [
                // optimize_tables (Boolean)
                // Periodically (once an hour) run an "optimize table" command for cache tables
                'optimize_tables' => false,
+
+               // display_resharer (Boolean)
+               // Display the first resharer as icon and text on a reshared item.
+               'display_resharer' => false,
        ],
 
        // Used in the admin settings to lock certain features
index 15247d874910c24fe05594d483d51fabba36c08f..3700c4f540738926abd0bf6992490ce77a762e4e 100644 (file)
@@ -18,6 +18,7 @@
        {{include file="field_checkbox.tpl" field=$infinite_scroll}}
        {{include file="field_checkbox.tpl" field=$no_smart_threading}}
        {{include file="field_checkbox.tpl" field=$hide_dislike}}
+       {{include file="field_checkbox.tpl" field=$display_resharer}}
 
        <h2>{{$calendar_title}}</h2>
        {{include file="field_select.tpl" field=$first_day_of_week}}
index defb0903b90b3766a71c906eb527c0ba90c8324e..4ba751836e5144347817a97e623f1aa26f0b51d5 100644 (file)
@@ -65,6 +65,7 @@
                                                {{include file="field_checkbox.tpl" field=$infinite_scroll}}
                                                {{include file="field_checkbox.tpl" field=$no_smart_threading}}
                                                {{include file="field_checkbox.tpl" field=$hide_dislike}}
+                                               {{include file="field_checkbox.tpl" field=$display_resharer}}
                                        </div>
                                        <div class="panel-footer">
                                                <button type="submit" name="submit" class="btn btn-primary" value="{{$submit}}">{{$submit}}</button>