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 | |
| 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')
| -rw-r--r-- | src/server/api/endpoints/drive/files/update.ts | 2 | ||||
| -rw-r--r-- | src/server/api/endpoints/drive/folders/create.ts | 2 | ||||
| -rw-r--r-- | src/server/api/endpoints/drive/folders/update.ts | 2 | ||||
| -rw-r--r-- | src/server/api/endpoints/following/delete.ts | 2 | ||||
| -rw-r--r-- | src/server/api/endpoints/i/regenerate_token.ts | 2 | ||||
| -rw-r--r-- | src/server/api/endpoints/i/update.ts | 2 | ||||
| -rw-r--r-- | src/server/api/endpoints/i/update_client_setting.ts | 2 | ||||
| -rw-r--r-- | src/server/api/endpoints/i/update_home.ts | 2 | ||||
| -rw-r--r-- | src/server/api/endpoints/i/update_mobile_home.ts | 2 | ||||
| -rw-r--r-- | src/server/api/endpoints/messaging/messages/create.ts | 5 | ||||
| -rw-r--r-- | src/server/api/endpoints/notifications/mark_as_read_all.ts | 2 | ||||
| -rw-r--r-- | src/server/api/endpoints/othello/match.ts | 2 | ||||
| -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 |
16 files changed, 28 insertions, 25 deletions
diff --git a/src/server/api/endpoints/drive/files/update.ts b/src/server/api/endpoints/drive/files/update.ts index 85bd2110f2..c783ad8b3b 100644 --- a/src/server/api/endpoints/drive/files/update.ts +++ b/src/server/api/endpoints/drive/files/update.ts @@ -4,7 +4,7 @@ import $ from 'cafy'; import DriveFolder from '../../../../../models/drive-folder'; import DriveFile, { validateFileName, pack } from '../../../../../models/drive-file'; -import { publishDriveStream } from '../../../../../event'; +import { publishDriveStream } from '../../../../../publishers/stream'; /** * Update a file diff --git a/src/server/api/endpoints/drive/folders/create.ts b/src/server/api/endpoints/drive/folders/create.ts index d9d39a9184..f34d0019d7 100644 --- a/src/server/api/endpoints/drive/folders/create.ts +++ b/src/server/api/endpoints/drive/folders/create.ts @@ -3,7 +3,7 @@ */ import $ from 'cafy'; import DriveFolder, { isValidFolderName, pack } from '../../../../../models/drive-folder'; -import { publishDriveStream } from '../../../../../event'; +import { publishDriveStream } from '../../../../../publishers/stream'; /** * Create drive folder diff --git a/src/server/api/endpoints/drive/folders/update.ts b/src/server/api/endpoints/drive/folders/update.ts index 1cea05d71c..dd7e8f5c86 100644 --- a/src/server/api/endpoints/drive/folders/update.ts +++ b/src/server/api/endpoints/drive/folders/update.ts @@ -3,7 +3,7 @@ */ import $ from 'cafy'; import DriveFolder, { isValidFolderName, pack } from '../../../../../models/drive-folder'; -import { publishDriveStream } from '../../../../../event'; +import { publishDriveStream } from '../../../../../publishers/stream'; /** * Update a folder diff --git a/src/server/api/endpoints/following/delete.ts b/src/server/api/endpoints/following/delete.ts index 77a6cebee0..3facfdcdd4 100644 --- a/src/server/api/endpoints/following/delete.ts +++ b/src/server/api/endpoints/following/delete.ts @@ -4,7 +4,7 @@ import $ from 'cafy'; import User, { pack as packUser } from '../../../../models/user'; import Following from '../../../../models/following'; -import event from '../../../../event'; +import event from '../../../../publishers/stream'; /** * Unfollow a user diff --git a/src/server/api/endpoints/i/regenerate_token.ts b/src/server/api/endpoints/i/regenerate_token.ts index d7cb697848..9aa6725f8c 100644 --- a/src/server/api/endpoints/i/regenerate_token.ts +++ b/src/server/api/endpoints/i/regenerate_token.ts @@ -4,7 +4,7 @@ import $ from 'cafy'; import * as bcrypt from 'bcryptjs'; import User from '../../../../models/user'; -import event from '../../../../event'; +import event from '../../../../publishers/stream'; import generateUserToken from '../../common/generate-native-user-token'; /** diff --git a/src/server/api/endpoints/i/update.ts b/src/server/api/endpoints/i/update.ts index c4ec413399..279b062f52 100644 --- a/src/server/api/endpoints/i/update.ts +++ b/src/server/api/endpoints/i/update.ts @@ -3,7 +3,7 @@ */ import $ from 'cafy'; import User, { isValidName, isValidDescription, isValidLocation, isValidBirthday, pack } from '../../../../models/user'; -import event from '../../../../event'; +import event from '../../../../publishers/stream'; import config from '../../../../config'; /** diff --git a/src/server/api/endpoints/i/update_client_setting.ts b/src/server/api/endpoints/i/update_client_setting.ts index 263ac6d07d..10741aceba 100644 --- a/src/server/api/endpoints/i/update_client_setting.ts +++ b/src/server/api/endpoints/i/update_client_setting.ts @@ -3,7 +3,7 @@ */ import $ from 'cafy'; import User, { pack } from '../../../../models/user'; -import event from '../../../../event'; +import event from '../../../../publishers/stream'; /** * Update myself diff --git a/src/server/api/endpoints/i/update_home.ts b/src/server/api/endpoints/i/update_home.ts index 227b8dd5a4..91be0714d7 100644 --- a/src/server/api/endpoints/i/update_home.ts +++ b/src/server/api/endpoints/i/update_home.ts @@ -3,7 +3,7 @@ */ import $ from 'cafy'; import User from '../../../../models/user'; -import event from '../../../../event'; +import event from '../../../../publishers/stream'; module.exports = async (params, user) => new Promise(async (res, rej) => { // Get 'home' parameter diff --git a/src/server/api/endpoints/i/update_mobile_home.ts b/src/server/api/endpoints/i/update_mobile_home.ts index 007eb2eab3..1efda120d5 100644 --- a/src/server/api/endpoints/i/update_mobile_home.ts +++ b/src/server/api/endpoints/i/update_mobile_home.ts @@ -3,7 +3,7 @@ */ import $ from 'cafy'; import User from '../../../../models/user'; -import event from '../../../../event'; +import event from '../../../../publishers/stream'; module.exports = async (params, user) => new Promise(async (res, rej) => { // Get 'home' parameter diff --git a/src/server/api/endpoints/messaging/messages/create.ts b/src/server/api/endpoints/messaging/messages/create.ts index 604da32d2e..085e75e6cf 100644 --- a/src/server/api/endpoints/messaging/messages/create.ts +++ b/src/server/api/endpoints/messaging/messages/create.ts @@ -9,8 +9,9 @@ import User from '../../../../../models/user'; import Mute from '../../../../../models/mute'; import DriveFile from '../../../../../models/drive-file'; import { pack } from '../../../../../models/messaging-message'; -import publishUserStream from '../../../../../event'; -import { publishMessagingStream, publishMessagingIndexStream, pushSw } from '../../../../../event'; +import publishUserStream from '../../../../../publishers/stream'; +import { publishMessagingStream, publishMessagingIndexStream } from '../../../../../publishers/stream'; +import pushSw from '../../../../../publishers/push-sw'; import html from '../../../../../text/html'; import parse from '../../../../../text/parse'; import config from '../../../../../config'; diff --git a/src/server/api/endpoints/notifications/mark_as_read_all.ts b/src/server/api/endpoints/notifications/mark_as_read_all.ts index 3ba00a9070..01c9145837 100644 --- a/src/server/api/endpoints/notifications/mark_as_read_all.ts +++ b/src/server/api/endpoints/notifications/mark_as_read_all.ts @@ -2,7 +2,7 @@ * Module dependencies */ import Notification from '../../../../models/notification'; -import event from '../../../../event'; +import event from '../../../../publishers/stream'; /** * Mark as read all notifications diff --git a/src/server/api/endpoints/othello/match.ts b/src/server/api/endpoints/othello/match.ts index 1fc46ab908..d9274f8f9c 100644 --- a/src/server/api/endpoints/othello/match.ts +++ b/src/server/api/endpoints/othello/match.ts @@ -2,7 +2,7 @@ import $ from 'cafy'; import Matching, { pack as packMatching } from '../../../../models/othello-matching'; import OthelloGame, { pack as packGame } from '../../../../models/othello-game'; import User from '../../../../models/user'; -import publishUserStream, { publishOthelloStream } from '../../../../event'; +import publishUserStream, { publishOthelloStream } from '../../../../publishers/stream'; import { eighteight } from '../../../../othello/maps'; module.exports = (params, user) => new Promise(async (res, rej) => { 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 |