mirror of
https://github.com/friendica/friendica
synced 2025-05-10 00:24:09 +02:00
Improve emoji federation and mastodon api compliance
This commit is contained in:
parent
dc69116572
commit
9bf7529dda
5 changed files with 79 additions and 7 deletions
|
@ -23,6 +23,7 @@ namespace Friendica\Protocol\ActivityPub;
|
|||
|
||||
use Friendica\App;
|
||||
use Friendica\Content\Feature;
|
||||
use Friendica\Content\Smilies;
|
||||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Core\Cache\Enum\Duration;
|
||||
use Friendica\Core\Logger;
|
||||
|
@ -1506,6 +1507,26 @@ class Transmitter
|
|||
return $location;
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends emoji tags to a tag array according to the tags used.
|
||||
*
|
||||
* @param array $tags Tag array
|
||||
* @param string $text Text containing tags like :tag:
|
||||
*/
|
||||
private static function addEmojiTags(array &$tags, string $text)
|
||||
{
|
||||
foreach (Smilies::extractUsedSmilies($text, true) as $name => $url) {
|
||||
$tags[] = [
|
||||
'type' => 'Emoji',
|
||||
'name' => $name,
|
||||
'icon' => [
|
||||
'type' => 'Image',
|
||||
'url' => $url,
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a tag array for a given item array
|
||||
*
|
||||
|
@ -1538,6 +1559,8 @@ class Transmitter
|
|||
}
|
||||
}
|
||||
|
||||
self::addEmojiTags($tags, $item['body']);
|
||||
|
||||
$announce = self::getAnnounceArray($item);
|
||||
// Mention the original author upon commented reshares
|
||||
if (!empty($announce['comment'])) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue