Merge pull request #9076 from annando/display-resharer

Optionally display the resharer as icon
This commit is contained in:
Hypolite Petovan 2020-08-26 14:11:12 -04:00 committed by GitHub
commit 4841ac7dc5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 948 additions and 852 deletions

View 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;

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_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],
]);

View 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

File diff suppressed because it is too large Load diff

View 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}}

View 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>