summaryrefslogtreecommitdiff
path: root/src/post/create.ts
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2018-04-07 16:26:50 +0900
committerGitHub <noreply@github.com>2018-04-07 16:26:50 +0900
commit2547891f940a2872fcfb2b33cd33d4f7a42ca7bc (patch)
tree5cba4ae9cdfd63e7e1ef74a002a7b742183e8d3c /src/post/create.ts
parentMerge pull request #1410 from akihikodaki/objec (diff)
parentRefactor (diff)
downloadmisskey-2547891f940a2872fcfb2b33cd33d4f7a42ca7bc.tar.gz
misskey-2547891f940a2872fcfb2b33cd33d4f7a42ca7bc.tar.bz2
misskey-2547891f940a2872fcfb2b33cd33d4f7a42ca7bc.zip
Merge pull request #1397 from syuilo/refactor
Refactor
Diffstat (limited to 'src/post/create.ts')
-rw-r--r--src/post/create.ts40
1 files changed, 0 insertions, 40 deletions
diff --git a/src/post/create.ts b/src/post/create.ts
deleted file mode 100644
index 4ad1503e0f..0000000000
--- a/src/post/create.ts
+++ /dev/null
@@ -1,40 +0,0 @@
-import Post from '../models/post';
-
-export default async (post, reply, repost, mentions) => {
- post.mentions = [];
-
- function addMention(mentionee) {
- // Reject if already added
- if (post.mentions.some(x => x.equals(mentionee))) return;
-
- // Add mention
- post.mentions.push(mentionee);
- }
-
- if (reply) {
- // Add mention
- addMention(reply.userId);
- post.replyId = reply._id;
- post._reply = { userId: reply.userId };
- } else {
- post.replyId = null;
- post._reply = null;
- }
-
- if (repost) {
- if (post.text) {
- // Add mention
- addMention(repost.userId);
- }
-
- post.repostId = repost._id;
- post._repost = { userId: repost.userId };
- } else {
- post.repostId = null;
- post._repost = null;
- }
-
- await Promise.all(mentions.map(({ _id }) => addMention(_id)));
-
- return Post.insert(post);
-};