diff options
| author | Akihiko Odaki <nekomanma@pixiv.co.jp> | 2018-04-02 13:33:46 +0900 |
|---|---|---|
| committer | Akihiko Odaki <nekomanma@pixiv.co.jp> | 2018-04-02 13:33:46 +0900 |
| commit | ad38cd2605a7cd857618a5498651d5b10e7b1bfc (patch) | |
| tree | 7a417a3bb5cfde837afa5bde0de2c1756b053e2b /src/server/api/endpoints/posts | |
| parent | Fix built module references (diff) | |
| download | sharkey-ad38cd2605a7cd857618a5498651d5b10e7b1bfc.tar.gz sharkey-ad38cd2605a7cd857618a5498651d5b10e7b1bfc.tar.bz2 sharkey-ad38cd2605a7cd857618a5498651d5b10e7b1bfc.zip | |
Introduce publishers directory
Diffstat (limited to 'src/server/api/endpoints/posts')
| -rw-r--r-- | src/server/api/endpoints/posts/create.ts | 15 | ||||
| -rw-r--r-- | src/server/api/endpoints/posts/polls/vote.ts | 4 | ||||
| -rw-r--r-- | src/server/api/endpoints/posts/reactions/create.ts | 5 | ||||
| -rw-r--r-- | src/server/api/endpoints/posts/reactions/delete.ts | 2 |
4 files changed, 14 insertions, 12 deletions
diff --git a/src/server/api/endpoints/posts/create.ts b/src/server/api/endpoints/posts/create.ts index bf08fe2839..34a3aa1901 100644 --- a/src/server/api/endpoints/posts/create.ts +++ b/src/server/api/endpoints/posts/create.ts @@ -15,8 +15,9 @@ import Watching from '../../../../models/post-watching'; import ChannelWatching from '../../../../models/channel-watching'; import { pack } from '../../../../models/post'; import watch from '../../common/watch-post'; -import event, { pushSw, publishChannelStream } from '../../../../event'; -import notify from '../../../../notify'; +import stream, { publishChannelStream } from '../../../../publishers/stream'; +import notify from '../../../../publishers/notify'; +import pushSw from '../../../../publishers/push-sw'; import getAcct from '../../../../user/get-acct'; import parseAcct from '../../../../user/parse-acct'; import config from '../../../../config'; @@ -306,7 +307,7 @@ module.exports = (params, user: ILocalUser, app) => new Promise(async (res, rej) }); const mentioneesMutedUserIds = mentioneeMutes.map(m => m.muteeId.toString()); if (mentioneesMutedUserIds.indexOf(user._id.toString()) == -1) { - event(mentionee, reason, postObj); + stream(mentionee, reason, postObj); pushSw(mentionee, reason, postObj); } } @@ -315,7 +316,7 @@ module.exports = (params, user: ILocalUser, app) => new Promise(async (res, rej) // タイムラインへの投稿 if (!channel) { // Publish event to myself's stream - event(user._id, 'post', postObj); + stream(user._id, 'post', postObj); // Fetch all followers const followers = await Following @@ -330,7 +331,7 @@ module.exports = (params, user: ILocalUser, app) => new Promise(async (res, rej) // Publish event to followers stream followers.forEach(following => - event(following.followerId, 'post', postObj)); + stream(following.followerId, 'post', postObj)); } // チャンネルへの投稿 @@ -354,7 +355,7 @@ module.exports = (params, user: ILocalUser, app) => new Promise(async (res, rej) // チャンネルの視聴者(のタイムライン)に配信 watches.forEach(w => { - event(w.userId, 'post', postObj); + stream(w.userId, 'post', postObj); }); } @@ -448,7 +449,7 @@ module.exports = (params, user: ILocalUser, app) => new Promise(async (res, rej) } else { // Publish event if (!user._id.equals(repost.userId)) { - event(repost.userId, 'repost', postObj); + stream(repost.userId, 'repost', postObj); } } diff --git a/src/server/api/endpoints/posts/polls/vote.ts b/src/server/api/endpoints/posts/polls/vote.ts index be1fd7b5d0..029fb93230 100644 --- a/src/server/api/endpoints/posts/polls/vote.ts +++ b/src/server/api/endpoints/posts/polls/vote.ts @@ -6,8 +6,8 @@ import Vote from '../../../../../models/poll-vote'; import Post from '../../../../../models/post'; import Watching from '../../../../../models/post-watching'; import watch from '../../../common/watch-post'; -import { publishPostStream } from '../../../../../event'; -import notify from '../../../../../notify'; +import { publishPostStream } from '../../../../../publishers/stream'; +import notify from '../../../../../publishers/notify'; /** * Vote poll of a post diff --git a/src/server/api/endpoints/posts/reactions/create.ts b/src/server/api/endpoints/posts/reactions/create.ts index 408b2483af..8b5f1e57d0 100644 --- a/src/server/api/endpoints/posts/reactions/create.ts +++ b/src/server/api/endpoints/posts/reactions/create.ts @@ -7,8 +7,9 @@ import Post, { pack as packPost } from '../../../../../models/post'; import { pack as packUser } from '../../../../../models/user'; import Watching from '../../../../../models/post-watching'; import watch from '../../../common/watch-post'; -import { publishPostStream, pushSw } from '../../../../../event'; -import notify from '../../../../../notify'; +import { publishPostStream } from '../../../../../publishers/stream'; +import notify from '../../../../../publishers/notify'; +import pushSw from '../../../../../publishers/push-sw'; /** * React to a post diff --git a/src/server/api/endpoints/posts/reactions/delete.ts b/src/server/api/endpoints/posts/reactions/delete.ts index 11f5c7dafa..3a88bbd7ca 100644 --- a/src/server/api/endpoints/posts/reactions/delete.ts +++ b/src/server/api/endpoints/posts/reactions/delete.ts @@ -4,7 +4,7 @@ import $ from 'cafy'; import Reaction from '../../../../../models/post-reaction'; import Post from '../../../../../models/post'; -// import event from '../../../event'; +// import event from '../../../publishers/stream'; /** * Unreact to a post |