Introduce publishers directory
This commit is contained in:
@ -1,9 +1,9 @@
|
||||
import * as mongo from 'mongodb';
|
||||
import Message from '../../../models/messaging-message';
|
||||
import { IMessagingMessage as IMessage } from '../../../models/messaging-message';
|
||||
import publishUserStream from '../../../event';
|
||||
import { publishMessagingStream } from '../../../event';
|
||||
import { publishMessagingIndexStream } from '../../../event';
|
||||
import publishUserStream from '../../../publishers/stream';
|
||||
import { publishMessagingStream } from '../../../publishers/stream';
|
||||
import { publishMessagingIndexStream } from '../../../publishers/stream';
|
||||
|
||||
/**
|
||||
* Mark as read message(s)
|
||||
|
@ -1,6 +1,6 @@
|
||||
import * as mongo from 'mongodb';
|
||||
import { default as Notification, INotification } from '../../../models/notification';
|
||||
import publishUserStream from '../../../event';
|
||||
import publishUserStream from '../../../publishers/stream';
|
||||
|
||||
/**
|
||||
* Mark as read notification(s)
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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';
|
||||
|
||||
/**
|
||||
|
@ -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';
|
||||
|
||||
/**
|
||||
|
@ -3,7 +3,7 @@
|
||||
*/
|
||||
import $ from 'cafy';
|
||||
import User, { pack } from '../../../../models/user';
|
||||
import event from '../../../../event';
|
||||
import event from '../../../../publishers/stream';
|
||||
|
||||
/**
|
||||
* Update myself
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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';
|
||||
|
@ -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
|
||||
|
@ -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) => {
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -3,7 +3,7 @@ import * as bcrypt from 'bcryptjs';
|
||||
import * as speakeasy from 'speakeasy';
|
||||
import User, { ILocalUser } from '../../../models/user';
|
||||
import Signin, { pack } from '../../../models/signin';
|
||||
import event from '../../../event';
|
||||
import event from '../../../publishers/stream';
|
||||
import signin from '../common/signin';
|
||||
import config from '../../../config';
|
||||
|
||||
|
@ -6,7 +6,7 @@ import * as uuid from 'uuid';
|
||||
import autwh from 'autwh';
|
||||
import redis from '../../../db/redis';
|
||||
import User, { pack } from '../../../models/user';
|
||||
import event from '../../../event';
|
||||
import event from '../../../publishers/stream';
|
||||
import config from '../../../config';
|
||||
import signin from '../common/signin';
|
||||
|
||||
|
@ -2,7 +2,7 @@ import * as websocket from 'websocket';
|
||||
import * as redis from 'redis';
|
||||
import * as CRC32 from 'crc-32';
|
||||
import OthelloGame, { pack } from '../../../models/othello-game';
|
||||
import { publishOthelloGameStream } from '../../../event';
|
||||
import { publishOthelloGameStream } from '../../../publishers/stream';
|
||||
import Othello from '../../../othello/core';
|
||||
import * as maps from '../../../othello/maps';
|
||||
import { ParsedUrlQuery } from 'querystring';
|
||||
|
@ -2,7 +2,7 @@ import * as mongo from 'mongodb';
|
||||
import * as websocket from 'websocket';
|
||||
import * as redis from 'redis';
|
||||
import Matching, { pack } from '../../../models/othello-matching';
|
||||
import publishUserStream from '../../../event';
|
||||
import publishUserStream from '../../../publishers/stream';
|
||||
|
||||
export default function(request: websocket.request, connection: websocket.connection, subscriber: redis.RedisClient, user: any): void {
|
||||
// Subscribe othello stream
|
||||
|
Reference in New Issue
Block a user