Merge pull request #13657 from annando/activity-counter
Display the total emoji activity
This commit is contained in:
commit
ced14a73d7
|
@ -251,19 +251,21 @@ class Conversation
|
||||||
/**
|
/**
|
||||||
* Format the activity text for an item/photo/video
|
* Format the activity text for an item/photo/video
|
||||||
*
|
*
|
||||||
* @param array $links = array of pre-linked names of actors
|
* @param array $links array of pre-linked names of actors
|
||||||
* @param string $verb = one of 'like, 'dislike', 'attendyes', 'attendno', 'attendmaybe'
|
* @param string $verb one of 'like, 'dislike', 'attendyes', 'attendno', 'attendmaybe'
|
||||||
* @param int $id = item id
|
* @param int $id item id
|
||||||
|
* @param string $activity Activity URI
|
||||||
|
* @param array $emojis Array with emoji reactions
|
||||||
* @return string formatted text
|
* @return string formatted text
|
||||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||||
*/
|
*/
|
||||||
public function formatActivity(array $links, string $verb, int $id): string
|
public function formatActivity(array $links, string $verb, int $id, string $activity, array $emojis): string
|
||||||
{
|
{
|
||||||
$this->profiler->startRecording('rendering');
|
$this->profiler->startRecording('rendering');
|
||||||
$expanded = '';
|
$expanded = '';
|
||||||
|
|
||||||
$phrase = $this->getLikerPhrase($verb, $links);
|
$phrase = $this->getLikerPhrase($verb, $links);
|
||||||
$total = count($links);
|
$total = max(count($links), $emojis[$activity]['total'] ?? 0);
|
||||||
|
|
||||||
if ($total > 1) {
|
if ($total > 1) {
|
||||||
$spanatts = "class=\"btn btn-link fakelink\" onclick=\"openClose('{$verb}list-$id');\"";
|
$spanatts = "class=\"btn btn-link fakelink\" onclick=\"openClose('{$verb}list-$id');\"";
|
||||||
|
|
|
@ -351,7 +351,7 @@ class Post
|
||||||
foreach ($response_verbs as $value => $verb) {
|
foreach ($response_verbs as $value => $verb) {
|
||||||
$responses[$verb] = [
|
$responses[$verb] = [
|
||||||
'self' => $conv_responses[$verb][$item['uri-id']]['self'] ?? 0,
|
'self' => $conv_responses[$verb][$item['uri-id']]['self'] ?? 0,
|
||||||
'output' => !empty($conv_responses[$verb][$item['uri-id']]) ? DI::conversation()->formatActivity($conv_responses[$verb][$item['uri-id']]['links'], $verb, $item['uri-id']) : '',
|
'output' => !empty($conv_responses[$verb][$item['uri-id']]) ? DI::conversation()->formatActivity($conv_responses[$verb][$item['uri-id']]['links'], $verb, $item['uri-id'], $verbs[$verb], $emojis) : '',
|
||||||
'total' => $emojis[$verbs[$verb]]['total'] ?? '',
|
'total' => $emojis[$verbs[$verb]]['total'] ?? '',
|
||||||
'title' => $emojis[$verbs[$verb]]['title'] ?? '',
|
'title' => $emojis[$verbs[$verb]]['title'] ?? '',
|
||||||
];
|
];
|
||||||
|
|
Loading…
Reference in New Issue
Block a user