diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2018-04-02 04:15:27 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2018-04-02 04:15:27 +0900 |
| commit | cd2542e0fd8578f6e41114ffebbda1f16f7d04ce (patch) | |
| tree | c339b7808fc2a3d72ae30cb86ddb7b9c21852652 /src/common/remote/activitypub/renderer/note.ts | |
| parent | Refactor (diff) | |
| download | sharkey-cd2542e0fd8578f6e41114ffebbda1f16f7d04ce.tar.gz sharkey-cd2542e0fd8578f6e41114ffebbda1f16f7d04ce.tar.bz2 sharkey-cd2542e0fd8578f6e41114ffebbda1f16f7d04ce.zip | |
Refactor
Diffstat (limited to 'src/common/remote/activitypub/renderer/note.ts')
| -rw-r--r-- | src/common/remote/activitypub/renderer/note.ts | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/src/common/remote/activitypub/renderer/note.ts b/src/common/remote/activitypub/renderer/note.ts deleted file mode 100644 index 2fe20b2136..0000000000 --- a/src/common/remote/activitypub/renderer/note.ts +++ /dev/null @@ -1,44 +0,0 @@ -import renderDocument from './document'; -import renderHashtag from './hashtag'; -import config from '../../../../conf'; -import DriveFile from '../../../../models/drive-file'; -import Post from '../../../../models/post'; -import User from '../../../../models/user'; - -export default async (user, post) => { - const promisedFiles = DriveFile.find({ _id: { $in: post.mediaIds } }); - let inReplyTo; - - if (post.replyId) { - const inReplyToPost = await Post.findOne({ - _id: post.replyId, - }); - - if (inReplyToPost !== null) { - const inReplyToUser = await User.findOne({ - _id: post.userId, - }); - - if (inReplyToUser !== null) { - inReplyTo = `${config.url}@${inReplyToUser.username}/${inReplyToPost._id}`; - } - } - } else { - inReplyTo = null; - } - - const attributedTo = `${config.url}/@${user.username}`; - - return { - id: `${attributedTo}/${post._id}`, - type: 'Note', - attributedTo, - content: post.textHtml, - published: post.createdAt.toISOString(), - to: 'https://www.w3.org/ns/activitystreams#Public', - cc: `${attributedTo}/followers`, - inReplyTo, - attachment: (await promisedFiles).map(renderDocument), - tag: post.tags.map(renderHashtag) - }; -}; |