diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2018-06-17 16:51:24 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-06-17 16:51:24 +0900 |
| commit | f1f466ed237cfdadd6be9ce81d341a9f38e34a3f (patch) | |
| tree | 4cb50830e27a8b19b71d32d9c215a1b1c2c0153e /src | |
| parent | Send servicewroker script (diff) | |
| parent | Fix #1729 (diff) | |
| download | sharkey-f1f466ed237cfdadd6be9ce81d341a9f38e34a3f.tar.gz sharkey-f1f466ed237cfdadd6be9ce81d341a9f38e34a3f.tar.bz2 sharkey-f1f466ed237cfdadd6be9ce81d341a9f38e34a3f.zip | |
Merge pull request #1730 from rinsuki/fix/1729
Fix #1729
Diffstat (limited to 'src')
| -rw-r--r-- | src/remote/activitypub/renderer/mention.ts | 13 | ||||
| -rw-r--r-- | src/remote/activitypub/renderer/note.ts | 13 |
2 files changed, 17 insertions, 9 deletions
diff --git a/src/remote/activitypub/renderer/mention.ts b/src/remote/activitypub/renderer/mention.ts index 4cba7d6a94..95cae52aa2 100644 --- a/src/remote/activitypub/renderer/mention.ts +++ b/src/remote/activitypub/renderer/mention.ts @@ -1,9 +1,8 @@ -export default (mention: { - uri: string; - username: string; - host: string; -}) => ({ +import { IUser, isRemoteUser } from "../../../models/user"; +import config from "../../../config"; + +export default (mention: IUser) => ({ type: 'Mention', - href: mention.uri, - name: `@${mention.username}@${mention.host}` + href: isRemoteUser(mention) ? mention.uri : `${config.url}/@${mention.username}`, + name: isRemoteUser(mention) ? `@${mention.username}@${mention.host}` : `@${mention.username}`, }); diff --git a/src/remote/activitypub/renderer/note.ts b/src/remote/activitypub/renderer/note.ts index aba0dc809a..f9e559d307 100644 --- a/src/remote/activitypub/renderer/note.ts +++ b/src/remote/activitypub/renderer/note.ts @@ -54,9 +54,18 @@ export default async function renderNote(note: INote, dive = true) { ? [`${attributedTo}/followers`].concat(mentions) : []; + const mentionUsers = await User.find({ + _id: { + $in: note.mentions + } + }); + const hashtagTags = (note.tags || []).map(renderHashtag); - const mentionTags = (note.mentionedRemoteUsers || []).map(renderMention); - const tag = hashtagTags.concat(mentionTags); + const mentionTags = mentionUsers.map(renderMention); + const tag = [ + ...hashtagTags, + ...mentionTags, + ]; return { id: `${config.url}/notes/${note._id}`, |