diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2018-10-07 11:06:17 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-10-07 11:06:17 +0900 |
| commit | d0570d7fe3a3bf3c6b0312dece74bacc04c3534a (patch) | |
| tree | 698218279a38f9c78b0350e81b8ac77ae52e4a0d /src/server/api/stream/channels/main.ts | |
| parent | Fix お知らせが確認中...のままになる(Announcement Fetching...) (... (diff) | |
| download | sharkey-d0570d7fe3a3bf3c6b0312dece74bacc04c3534a.tar.gz sharkey-d0570d7fe3a3bf3c6b0312dece74bacc04c3534a.tar.bz2 sharkey-d0570d7fe3a3bf3c6b0312dece74bacc04c3534a.zip | |
V10 (#2826)
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* Update CHANGELOG.md
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* Update CHANGELOG.md
* Update CHANGELOG.md
* wip
* Update CHANGELOG.md
* wip
* wip
* wip
* wip
Diffstat (limited to 'src/server/api/stream/channels/main.ts')
| -rw-r--r-- | src/server/api/stream/channels/main.ts | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/server/api/stream/channels/main.ts b/src/server/api/stream/channels/main.ts new file mode 100644 index 0000000000..a6c5b12760 --- /dev/null +++ b/src/server/api/stream/channels/main.ts @@ -0,0 +1,25 @@ +import autobind from 'autobind-decorator'; +import Mute from '../../../../models/mute'; +import Channel from '../channel'; + +export default class extends Channel { + @autobind + public async init(params: any) { + const mute = await Mute.find({ muterId: this.user._id }); + const mutedUserIds = mute.map(m => m.muteeId.toString()); + + // Subscribe main stream channel + this.subscriber.on(`mainStream:${this.user._id}`, async data => { + const { type, body } = data; + + switch (type) { + case 'notification': { + if (!mutedUserIds.includes(body.userId)) { + this.send('notification', body); + } + break; + } + } + }); + } +} |