summaryrefslogtreecommitdiff
path: root/src/server/api/stream/channels/main.ts
diff options
context:
space:
mode:
authortamaina <tamaina@hotmail.co.jp>2021-10-21 01:04:10 +0900
committerGitHub <noreply@github.com>2021-10-21 01:04:10 +0900
commit69b56f6658dcbef0a54fa030ebf30913ca3d30bd (patch)
tree376ee75076a4c7de6be2c6b3a54168319b8ded84 /src/server/api/stream/channels/main.ts
parentMerge branch 'develop' of https://github.com/misskey-dev/misskey into develop (diff)
downloadsharkey-69b56f6658dcbef0a54fa030ebf30913ca3d30bd.tar.gz
sharkey-69b56f6658dcbef0a54fa030ebf30913ca3d30bd.tar.bz2
sharkey-69b56f6658dcbef0a54fa030ebf30913ca3d30bd.zip
refactor: publishHogeStreamとStreamのEventEmitterに型定義する (#7769)
* wip * wip * wip * :v: * add main stream * packedNotificationSchemaを更新 * read:gallery, write:gallery, read:gallery-likes, write:gallery-likesに翻訳を追加 * fix * ok * add header, choice, invitation * add header, choice, invitation * test * fix * fix * yatta * remove no longer needed "as PackedUser/PackedNote" * clean up * add simple-schema * fix lint * fix lint * wip * wip! * wip * fix * wip * wip * :v: * 送信側に型エラーがないことを3回確認した * :v: * wip * update typescript * define items in full Schema * edit comment * edit comment * edit comment * Update src/prelude/types.ts Co-authored-by: Acid Chicken (硫酸鶏) <root@acid-chicken.com> * https://github.com/misskey-dev/misskey/pull/7769#discussion_r703058458 * user packとnote packの型不整合を修正 * revert https://github.com/misskey-dev/misskey/pull/7772#discussion_r706627736 * revert https://github.com/misskey-dev/misskey/pull/7772#discussion_r706627736 * user packとnote packの型不整合を修正 * add prelude/types.ts * emoji * signin * game * matching * clean up * ev => data * refactor * clean up * add type * antenna * channel * fix * add Packed type * add PackedRef * fix lint * add emoji schema * add reversiGame * add reversiMatching * remove signin schema (use Signin entity) * add schemas refs, fix Packed type * wip PackedHoge => Packed<'Hoge'> * add Packed type * note-reaction * user * user-group * user-list * note * app, messaging-message * notification * drive-file * drive-folder * following * muting * blocking * hashtag * page * app (with modifying schema) * import user? * channel * antenna * clip * gallery-post * emoji * Packed * reversi-matching * update stream.ts * https://github.com/misskey-dev/misskey/pull/7769#issuecomment-917542339 * fix lint * clean up? * add changelog * add changelog * add changelog * fix: アンテナが既読にならないのを修正 * revert fix * https://github.com/misskey-dev/misskey/pull/7769#discussion_r711474875 * spec => payload * edit commetn Co-authored-by: Acid Chicken (硫酸鶏) <root@acid-chicken.com>
Diffstat (limited to 'src/server/api/stream/channels/main.ts')
-rw-r--r--src/server/api/stream/channels/main.ts24
1 files changed, 11 insertions, 13 deletions
diff --git a/src/server/api/stream/channels/main.ts b/src/server/api/stream/channels/main.ts
index b99cb931da..131ac30472 100644
--- a/src/server/api/stream/channels/main.ts
+++ b/src/server/api/stream/channels/main.ts
@@ -11,35 +11,33 @@ export default class extends Channel {
public async init(params: any) {
// Subscribe main stream channel
this.subscriber.on(`mainStream:${this.user!.id}`, async data => {
- const { type } = data;
- let { body } = data;
-
- switch (type) {
+ switch (data.type) {
case 'notification': {
- if (this.muting.has(body.userId)) return;
- if (body.note && body.note.isHidden) {
- const note = await Notes.pack(body.note.id, this.user, {
+ if (data.body.userId && this.muting.has(data.body.userId)) return;
+
+ if (data.body.note && data.body.note.isHidden) {
+ const note = await Notes.pack(data.body.note.id, this.user, {
detail: true
});
this.connection.cacheNote(note);
- body.note = note;
+ data.body.note = note;
}
break;
}
case 'mention': {
- if (this.muting.has(body.userId)) return;
- if (body.isHidden) {
- const note = await Notes.pack(body.id, this.user, {
+ if (this.muting.has(data.body.userId)) return;
+ if (data.body.isHidden) {
+ const note = await Notes.pack(data.body.id, this.user, {
detail: true
});
this.connection.cacheNote(note);
- body = note;
+ data.body = note;
}
break;
}
}
- this.send(type, body);
+ this.send(data.type, data.body);
});
}
}