diff options
author | Mario <mario@mariovavti.com> | 2024-02-04 19:50:31 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2024-02-04 19:50:31 +0000 |
commit | 209651705db81d43a3a0546866467e0bf26fd7b9 (patch) | |
tree | e71ff365e2b5666a2debaf3f08c3bacec29dcfe9 /Zotlabs/Lib/Activity.php | |
parent | fab3c92a7c881be049cba62a950e90732d8c1ec5 (diff) | |
download | volse-hubzilla-209651705db81d43a3a0546866467e0bf26fd7b9.tar.gz volse-hubzilla-209651705db81d43a3a0546866467e0bf26fd7b9.tar.bz2 volse-hubzilla-209651705db81d43a3a0546866467e0bf26fd7b9.zip |
fix custom emoji reactions arriving from pleroma
Diffstat (limited to 'Zotlabs/Lib/Activity.php')
-rw-r--r-- | Zotlabs/Lib/Activity.php | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php index 089fb3687..ddd91f60b 100644 --- a/Zotlabs/Lib/Activity.php +++ b/Zotlabs/Lib/Activity.php @@ -2187,9 +2187,22 @@ class Activity { if (in_array($act->type, ['EmojiReaction', 'EmojiReact'])) { // Pleroma reactions $t = trim(self::get_textfield($act->data, 'content')); + + // Unicode emojis if (mb_strlen($t) === 1) { $content['content'] = $t; } + // Custom emojis + elseif (preg_match('/^[:].*[:]$/i', $t, $match)) { + $content['content'] = $match[0]; + if (isset($act->data['tag']) && is_array($act->data['tag'])) { + foreach ($act->data['tag'] as $tag) { + if ($tag['type'] === 'Emoji' && $tag['name'] === trim($match[0], ':')) { + $content['content'] = '[img=32x32]' . $tag['id'] . '[/img]'; + } + } + } + } } } |