tally repeats

This commit is contained in:
Mike Macgirvin 2024-03-22 18:27:28 +11:00
parent 86867970d7
commit b164ee0c91
2 changed files with 20 additions and 0 deletions

View file

@ -438,6 +438,7 @@ function conversation($items, $mode, $update, $page_mode = 'traditional', $prepa
$conv_responses = [
'like' => [ 'title' => t('Likes', 'title') ],
'dislike' => [ 'title' => t('Dislikes', 'title') ],
'repeat' => [ 'title' => t('Repeats', 'title') ],
'attendyes' => [ 'title' => t('Attending', 'title') ],
'attendno' => [ 'title' => t('Not attending', 'title') ],
'attendmaybe' => [ 'title' => t('Might attend', 'title') ]
@ -944,6 +945,9 @@ function builtin_activity_puller($item, &$conv_responses)
case 'dislike':
$verb = ACTIVITY_DISLIKE;
break;
case 'repeat':
$verb = 'Announce';
break;
case 'attendyes':
$verb = 'Accept';
break;

View file

@ -257,6 +257,17 @@ class ThreadItem
$dislike_list_part = '';
}
$repeat_count = ((x($conv_responses['repeat'], $item['mid'])) ? $conv_responses['repeat'][$item['mid']] : '');
$repeat_list = ((x($conv_responses['repeat'], $item['mid'])) ? $conv_responses['repeat'][$item['mid'] . '-l'] : '');
if (($repeat_list) && (count($repeat_list) > MAX_LIKERS)) {
$repeat_list_part = array_slice($repeat_list, 0, MAX_LIKERS);
array_push($repeat_list_part, '<a class="dropdown-item" href="#" data-bs-toggle="modal" data-bs-target="#repeatModal-' . $this->get_id() . '"><b>' . t('View all') . '</b></a>');
} else {
$repeat_list_part = '';
}
/*
* We should avoid doing this all the time, but it depends on the conversation mode
* And the conv mode may change when we change the conv, or it changes its mode
@ -513,6 +524,11 @@ class ThreadItem
'dislike_list' => $dislike_list,
'dislike_list_part' => $dislike_list_part,
'dislike_button_label' => $dislike_button_label,
'repeat_modal_title' => t('Repeats', 'noun'),
'repeat_count' => $repeat_count,
'repeat_list' => $repeat_list,
'repeat_list_part' => $repeat_list_part,
'repeat_button_label' => $repeat_button_label,
'modal_dismiss' => t('Close'),
'comment' => ($item['item_delayed'] ? '' : $this->get_comment_box()),
'previewing' => ($conv->is_preview() ? true : false ),