Optionally display the resharer as icon

This commit is contained in:
Michael 2020-08-26 12:33:17 +00:00
parent 176165b83b
commit 355284841a
5 changed files with 17 additions and 0 deletions

View file

@ -711,6 +711,7 @@ function conversation_fetch_comments($thread_items, $pinned) {
$parentlines = []; $parentlines = [];
$lineno = 0; $lineno = 0;
$direction = []; $direction = [];
$actor = [];
$received = ''; $received = '';
while ($row = Item::fetch($thread_items)) { 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) && ($row['thr-parent'] == $row['parent-uri']) && ($row['received'] > $received)
&& Contact::isSharing($row['author-id'], $row['uid'])) { && Contact::isSharing($row['author-id'], $row['uid'])) {
$direction = ['direction' => 3, 'title' => DI::l10n()->t('%s reshared this.', $row['author-name'])]; $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']; $received = $row['received'];
} }
@ -748,6 +750,11 @@ function conversation_fetch_comments($thread_items, $pinned) {
if (!empty($direction)) { if (!empty($direction)) {
foreach ($parentlines as $line) { foreach ($parentlines as $line) {
$comments[$line]['direction'] = $direction; $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; return $comments;

View file

@ -52,6 +52,7 @@ class Display extends BaseSettings
$no_auto_update = !empty($_POST['no_auto_update']) ? intval($_POST['no_auto_update']) : 0; $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; $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; $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; $browser_update = !empty($_POST['browser_update']) ? intval($_POST['browser_update']) : 0;
if ($browser_update != -1) { if ($browser_update != -1) {
$browser_update = $browser_update * 1000; $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', 'infinite_scroll' , $infinite_scroll);
DI::pConfig()->set(local_user(), 'system', 'no_smart_threading' , $no_smart_threading); 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', '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); DI::pConfig()->set(local_user(), 'system', 'first_day_of_week' , $first_day_of_week);
if (in_array($theme, Theme::getAllowedList())) { 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); $infinite_scroll = DI::pConfig()->get(local_user(), 'system', 'infinite_scroll', 0);
$no_smart_threading = DI::pConfig()->get(local_user(), 'system', 'no_smart_threading', 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); $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); $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")]; $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.')], '$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.')], '$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.')], '$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], '$first_day_of_week' => ['first_day_of_week', DI::l10n()->t('Beginning of week:'), $first_day_of_week, '', $weekdays, false],
]); ]);

View file

@ -150,6 +150,10 @@ return [
// optimize_tables (Boolean) // optimize_tables (Boolean)
// Periodically (once an hour) run an "optimize table" command for cache tables // Periodically (once an hour) run an "optimize table" command for cache tables
'optimize_tables' => false, '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 // Used in the admin settings to lock certain features

View file

@ -18,6 +18,7 @@
{{include file="field_checkbox.tpl" field=$infinite_scroll}} {{include file="field_checkbox.tpl" field=$infinite_scroll}}
{{include file="field_checkbox.tpl" field=$no_smart_threading}} {{include file="field_checkbox.tpl" field=$no_smart_threading}}
{{include file="field_checkbox.tpl" field=$hide_dislike}} {{include file="field_checkbox.tpl" field=$hide_dislike}}
{{include file="field_checkbox.tpl" field=$display_resharer}}
<h2>{{$calendar_title}}</h2> <h2>{{$calendar_title}}</h2>
{{include file="field_select.tpl" field=$first_day_of_week}} {{include file="field_select.tpl" field=$first_day_of_week}}

View file

@ -65,6 +65,7 @@
{{include file="field_checkbox.tpl" field=$infinite_scroll}} {{include file="field_checkbox.tpl" field=$infinite_scroll}}
{{include file="field_checkbox.tpl" field=$no_smart_threading}} {{include file="field_checkbox.tpl" field=$no_smart_threading}}
{{include file="field_checkbox.tpl" field=$hide_dislike}} {{include file="field_checkbox.tpl" field=$hide_dislike}}
{{include file="field_checkbox.tpl" field=$display_resharer}}
</div> </div>
<div class="panel-footer"> <div class="panel-footer">
<button type="submit" name="submit" class="btn btn-primary" value="{{$submit}}">{{$submit}}</button> <button type="submit" name="submit" class="btn btn-primary" value="{{$submit}}">{{$submit}}</button>