This commit is contained in:
parent
4e6dcd16ac
commit
83d9730d93
33 changed files with 189 additions and 242 deletions
|
|
@ -1,5 +1,5 @@
|
|||
import * as websocket from 'websocket';
|
||||
import * as redis from 'redis';
|
||||
import Xev from 'xev';
|
||||
|
||||
import { IUser } from '../../../models/user';
|
||||
import Mute from '../../../models/mute';
|
||||
|
|
@ -7,18 +7,14 @@ import Mute from '../../../models/mute';
|
|||
export default async function(
|
||||
request: websocket.request,
|
||||
connection: websocket.connection,
|
||||
subscriber: redis.RedisClient,
|
||||
subscriber: Xev,
|
||||
user: IUser
|
||||
) {
|
||||
// Subscribe stream
|
||||
subscriber.subscribe(`misskey:global-timeline`);
|
||||
|
||||
const mute = await Mute.find({ muterId: user._id });
|
||||
const mutedUserIds = mute.map(m => m.muteeId.toString());
|
||||
|
||||
subscriber.on('message', async (_, data) => {
|
||||
const note = JSON.parse(data);
|
||||
|
||||
// Subscribe stream
|
||||
subscriber.on('global-timeline', async note => {
|
||||
//#region 流れてきたNoteがミュートしているユーザーが関わるものだったら無視する
|
||||
if (mutedUserIds.indexOf(note.userId) != -1) {
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue