mirror of
https://github.com/friendica/friendica
synced 2024-12-22 22:00:16 +00:00
Merge pull request #14444 from annando/Emoji-count
Fix counter for emoji reactions
This commit is contained in:
commit
a2ad3080e1
2 changed files with 23 additions and 23 deletions
|
@ -1018,18 +1018,18 @@ class Conversation
|
||||||
}
|
}
|
||||||
|
|
||||||
// @todo The following code should be removed, once that we display activity authors on demand
|
// @todo The following code should be removed, once that we display activity authors on demand
|
||||||
$activity_emoji = [
|
$activity_verbs = [
|
||||||
Activity::LIKE => '👍',
|
Activity::LIKE,
|
||||||
Activity::DISLIKE => '👎',
|
Activity::DISLIKE,
|
||||||
Activity::ATTEND => '✔️',
|
Activity::ATTEND,
|
||||||
Activity::ATTENDMAYBE => '❓',
|
Activity::ATTENDMAYBE,
|
||||||
Activity::ATTENDNO => '❌',
|
Activity::ATTENDNO,
|
||||||
Activity::ANNOUNCE => '♻',
|
Activity::ANNOUNCE,
|
||||||
Activity::VIEW => '📺',
|
Activity::VIEW,
|
||||||
Activity::READ => '📖',
|
Activity::READ,
|
||||||
];
|
];
|
||||||
|
|
||||||
$verbs = array_merge(array_keys($activity_emoji), [Activity::EMOJIREACT, Activity::POST]);
|
$verbs = array_merge($activity_verbs, [Activity::EMOJIREACT, Activity::POST]);
|
||||||
$condition = DBA::mergeConditions(['parent-uri-id' => $uriids, 'gravity' => [ItemModel::GRAVITY_ACTIVITY, ItemModel::GRAVITY_COMMENT], 'verb' => $verbs], ["NOT `deleted`"]);
|
$condition = DBA::mergeConditions(['parent-uri-id' => $uriids, 'gravity' => [ItemModel::GRAVITY_ACTIVITY, ItemModel::GRAVITY_COMMENT], 'verb' => $verbs], ["NOT `deleted`"]);
|
||||||
$separator = chr(255) . chr(255) . chr(255);
|
$separator = chr(255) . chr(255) . chr(255);
|
||||||
|
|
||||||
|
@ -1038,7 +1038,7 @@ class Conversation
|
||||||
$rows = DBA::p($sql, $condition);
|
$rows = DBA::p($sql, $condition);
|
||||||
while ($row = DBA::fetch($rows)) {
|
while ($row = DBA::fetch($rows)) {
|
||||||
if ($row['gravity'] == ItemModel::GRAVITY_ACTIVITY) {
|
if ($row['gravity'] == ItemModel::GRAVITY_ACTIVITY) {
|
||||||
$emoji = $row['body'] ?: $activity_emoji[$row['verb']];
|
$emoji = $row['body'] ?: $row['verb'];
|
||||||
} else {
|
} else {
|
||||||
$emoji = '';
|
$emoji = '';
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,18 +82,18 @@ class Counts
|
||||||
{
|
{
|
||||||
$counts = [];
|
$counts = [];
|
||||||
|
|
||||||
$activity_emoji = [
|
$activity_verbs = [
|
||||||
Activity::LIKE => '👍',
|
Activity::LIKE,
|
||||||
Activity::DISLIKE => '👎',
|
Activity::DISLIKE,
|
||||||
Activity::ATTEND => '✔️',
|
Activity::ATTEND,
|
||||||
Activity::ATTENDMAYBE => '❓',
|
Activity::ATTENDMAYBE,
|
||||||
Activity::ATTENDNO => '❌',
|
Activity::ATTENDNO,
|
||||||
Activity::ANNOUNCE => '♻',
|
Activity::ANNOUNCE,
|
||||||
Activity::VIEW => '📺',
|
Activity::VIEW,
|
||||||
Activity::READ => '📖',
|
Activity::READ,
|
||||||
];
|
];
|
||||||
|
|
||||||
$verbs = array_merge(array_keys($activity_emoji), [Activity::EMOJIREACT, Activity::POST]);
|
$verbs = array_merge($activity_verbs, [Activity::EMOJIREACT, Activity::POST]);
|
||||||
|
|
||||||
$condition = DBA::mergeConditions($condition, ['verb' => $verbs]);
|
$condition = DBA::mergeConditions($condition, ['verb' => $verbs]);
|
||||||
$countquery = DBA::select('post-counts-view', [], $condition);
|
$countquery = DBA::select('post-counts-view', [], $condition);
|
||||||
|
@ -101,8 +101,8 @@ class Counts
|
||||||
if (!empty($count['reaction'])) {
|
if (!empty($count['reaction'])) {
|
||||||
$count['verb'] = Activity::EMOJIREACT;
|
$count['verb'] = Activity::EMOJIREACT;
|
||||||
$count['vid'] = Verb::getID($count['verb']);
|
$count['vid'] = Verb::getID($count['verb']);
|
||||||
} elseif (!empty($activity_emoji[$count['verb']])) {
|
} elseif (in_array($count['verb'], $activity_verbs)) {
|
||||||
$count['reaction'] = $activity_emoji[$count['verb']];
|
$count['reaction'] = $count['verb'];
|
||||||
}
|
}
|
||||||
$counts[] = $count;
|
$counts[] = $count;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue