diff options
| author | MeiMei <30769358+mei23@users.noreply.github.com> | 2020-04-14 00:42:59 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-04-14 00:42:59 +0900 |
| commit | 9b07c5af05a8be8114af860893d68614e4ee5ca2 (patch) | |
| tree | 3ca2587fe8e4d0bb845d2f42f443e21d224c4d6f /src/remote/activitypub/renderer | |
| parent | chore(client): :art: (diff) | |
| download | sharkey-9b07c5af05a8be8114af860893d68614e4ee5ca2.tar.gz sharkey-9b07c5af05a8be8114af860893d68614e4ee5ca2.tar.bz2 sharkey-9b07c5af05a8be8114af860893d68614e4ee5ca2.zip | |
リモートのカスタム絵文字リアクションを表示できるように (#6239)
* リモートのカスタム絵文字リアクションを表示できるように
* AP
* DBマイグレーション
* ローカルのリアクションの.
* fix
* fix
* fix
* space
Diffstat (limited to 'src/remote/activitypub/renderer')
| -rw-r--r-- | src/remote/activitypub/renderer/like.ts | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/src/remote/activitypub/renderer/like.ts b/src/remote/activitypub/renderer/like.ts index e36a3ab0d6..d4dd3663d4 100644 --- a/src/remote/activitypub/renderer/like.ts +++ b/src/remote/activitypub/renderer/like.ts @@ -1,12 +1,30 @@ import config from '../../../config'; import { NoteReaction } from '../../../models/entities/note-reaction'; import { Note } from '../../../models/entities/note'; +import { Emojis } from '../../../models'; +import renderEmoji from './emoji'; -export const renderLike = (noteReaction: NoteReaction, note: Note) => ({ - type: 'Like', - id: `${config.url}/likes/${noteReaction.id}`, - actor: `${config.url}/users/${noteReaction.userId}`, - object: note.uri ? note.uri : `${config.url}/notes/${noteReaction.noteId}`, - content: noteReaction.reaction, - _misskey_reaction: noteReaction.reaction -}); +export const renderLike = async (noteReaction: NoteReaction, note: Note) => { + const reaction = noteReaction.reaction; + + const object = { + type: 'Like', + id: `${config.url}/likes/${noteReaction.id}`, + actor: `${config.url}/users/${noteReaction.userId}`, + object: note.uri ? note.uri : `${config.url}/notes/${noteReaction.noteId}`, + content: reaction, + _misskey_reaction: reaction + } as any; + + if (reaction.startsWith(':')) { + const name = reaction.replace(/:/g, ''); + const emoji = await Emojis.findOne({ + name, + host: null + }); + + if (emoji) object.tag = [ renderEmoji(emoji) ]; + } + + return object; +}; |