diff --git a/packages/backend/src/server/api/stream/channels/antenna.ts b/packages/backend/src/server/api/stream/channels/antenna.ts index 5c16cea60..7fd34ccfd 100644 --- a/packages/backend/src/server/api/stream/channels/antenna.ts +++ b/packages/backend/src/server/api/stream/channels/antenna.ts @@ -15,7 +15,7 @@ class AntennaChannel extends Channel { public static readonly requireCredential = true as const; public static readonly kind = 'read:account'; private antennaId: string; - private idOnly: boolean; + private minimize: boolean; constructor( private noteEntityService: NoteEntityService, @@ -30,7 +30,7 @@ class AntennaChannel extends Channel { @bindThis public async init(params: any) { this.antennaId = params.antennaId as string; - this.idOnly = params.idOnly ?? false; + this.minimize = params.minimize ?? false; // Subscribe stream this.subscriber.on(`antennaStream:${this.antennaId}`, this.onEvent); @@ -51,9 +51,13 @@ class AntennaChannel extends Channel { if (this.isNoteMutedOrBlocked(note)) return; - if (this.idOnly && ['public', 'home'].includes(note.visibility)) { - const idOnlyNote = { id: note.id }; - this.send('note', idOnlyNote); + if (this.minimize && ['public', 'home'].includes(note.visibility)) { + this.send('note', { + id: note.id, myReaction: note.myReaction, + poll: note.poll ? { choices: note.poll.choices } : undefined, + reply: note.reply ? { myReaction: note.reply.myReaction } : undefined, + renote: note.renote ? { myReaction: note.renote.myReaction } : undefined, + }); } else { this.connection.cacheNote(note); this.send('note', note); diff --git a/packages/backend/src/server/api/stream/channels/channel.ts b/packages/backend/src/server/api/stream/channels/channel.ts index 94ffcd5d6..e97928c8d 100644 --- a/packages/backend/src/server/api/stream/channels/channel.ts +++ b/packages/backend/src/server/api/stream/channels/channel.ts @@ -15,7 +15,7 @@ class ChannelChannel extends Channel { public static readonly shouldShare = false; public static readonly requireCredential = false as const; private channelId: string; - private idOnly: boolean; + private minimize: boolean; constructor( private noteEntityService: NoteEntityService, @@ -30,7 +30,7 @@ class ChannelChannel extends Channel { @bindThis public async init(params: any) { this.channelId = params.channelId as string; - this.idOnly = params.idOnly ?? false; + this.minimize = params.minimize ?? false; // Subscribe stream this.subscriber.on('notesStream', this.onNote); @@ -57,9 +57,13 @@ class ChannelChannel extends Channel { } } - if (this.idOnly && ['public', 'home'].includes(note.visibility)) { - const idOnlyNote = { id: note.id }; - this.send('note', idOnlyNote); + if (this.minimize && ['public', 'home'].includes(note.visibility)) { + this.send('note', { + id: note.id, myReaction: note.myReaction, + poll: note.poll ? { choices: note.poll.choices } : undefined, + reply: note.reply ? { myReaction: note.reply.myReaction } : undefined, + renote: note.renote ? { myReaction: note.renote.myReaction } : undefined, + }); } else { this.connection.cacheNote(note); this.send('note', note); diff --git a/packages/backend/src/server/api/stream/channels/global-timeline.ts b/packages/backend/src/server/api/stream/channels/global-timeline.ts index 64f194160..d5f32c91f 100644 --- a/packages/backend/src/server/api/stream/channels/global-timeline.ts +++ b/packages/backend/src/server/api/stream/channels/global-timeline.ts @@ -18,7 +18,7 @@ class GlobalTimelineChannel extends Channel { public static readonly requireCredential = false as const; private withRenotes: boolean; private withFiles: boolean; - private idOnly: boolean; + private minimize: boolean; constructor( private metaService: MetaService, @@ -39,7 +39,7 @@ class GlobalTimelineChannel extends Channel { this.withRenotes = params.withRenotes ?? true; this.withFiles = params.withFiles ?? false; - this.idOnly = params.idOnly ?? false; + this.minimize = params.minimize ?? false; // Subscribe events this.subscriber.on('notesStream', this.onNote); @@ -87,9 +87,13 @@ class GlobalTimelineChannel extends Channel { } } - if (this.idOnly && ['public', 'home'].includes(note.visibility)) { - const idOnlyNote = { id: note.id }; - this.send('note', idOnlyNote); + if (this.minimize && ['public', 'home'].includes(note.visibility)) { + this.send('note', { + id: note.id, myReaction: note.myReaction, + poll: note.poll ? { choices: note.poll.choices } : undefined, + reply: note.reply ? { myReaction: note.reply.myReaction } : undefined, + renote: note.renote ? { myReaction: note.renote.myReaction } : undefined, + }); } else { this.connection.cacheNote(note); this.send('note', note); diff --git a/packages/backend/src/server/api/stream/channels/home-timeline.ts b/packages/backend/src/server/api/stream/channels/home-timeline.ts index 3ee193522..0f983c977 100644 --- a/packages/backend/src/server/api/stream/channels/home-timeline.ts +++ b/packages/backend/src/server/api/stream/channels/home-timeline.ts @@ -17,7 +17,7 @@ class HomeTimelineChannel extends Channel { public static readonly kind = 'read:account'; private withRenotes: boolean; private withFiles: boolean; - private idOnly: boolean; + private minimize: boolean; constructor( private noteEntityService: NoteEntityService, @@ -33,7 +33,7 @@ class HomeTimelineChannel extends Channel { public async init(params: any) { this.withRenotes = params.withRenotes ?? true; this.withFiles = params.withFiles ?? false; - this.idOnly = params.idOnly ?? false; + this.minimize = params.minimize ?? false; this.subscriber.on('notesStream', this.onNote); } @@ -91,9 +91,13 @@ class HomeTimelineChannel extends Channel { } } - if (this.idOnly && ['public', 'home'].includes(note.visibility)) { - const idOnlyNote = { id: note.id }; - this.send('note', idOnlyNote); + if (this.minimize && ['public', 'home'].includes(note.visibility)) { + this.send('note', { + id: note.id, myReaction: note.myReaction, + poll: note.poll ? { choices: note.poll.choices } : undefined, + reply: note.reply ? { myReaction: note.reply.myReaction } : undefined, + renote: note.renote ? { myReaction: note.renote.myReaction } : undefined, + }); } else { this.connection.cacheNote(note); this.send('note', note); diff --git a/packages/backend/src/server/api/stream/channels/hybrid-timeline.ts b/packages/backend/src/server/api/stream/channels/hybrid-timeline.ts index 20337f85b..8234d5c23 100644 --- a/packages/backend/src/server/api/stream/channels/hybrid-timeline.ts +++ b/packages/backend/src/server/api/stream/channels/hybrid-timeline.ts @@ -20,7 +20,7 @@ class HybridTimelineChannel extends Channel { private withRenotes: boolean; private withReplies: boolean; private withFiles: boolean; - private idOnly: boolean; + private minimize: boolean; constructor( private metaService: MetaService, @@ -42,7 +42,7 @@ class HybridTimelineChannel extends Channel { this.withRenotes = params.withRenotes ?? true; this.withReplies = params.withReplies ?? false; this.withFiles = params.withFiles ?? false; - this.idOnly = params.idOnly ?? false; + this.minimize = params.minimize ?? false; // Subscribe events this.subscriber.on('notesStream', this.onNote); @@ -105,9 +105,13 @@ class HybridTimelineChannel extends Channel { } } - if (this.idOnly && ['public', 'home'].includes(note.visibility)) { - const idOnlyNote = { id: note.id }; - this.send('note', idOnlyNote); + if (this.minimize && ['public', 'home'].includes(note.visibility)) { + this.send('note', { + id: note.id, myReaction: note.myReaction, + poll: note.poll ? { choices: note.poll.choices } : undefined, + reply: note.reply ? { myReaction: note.reply.myReaction } : undefined, + renote: note.renote ? { myReaction: note.renote.myReaction } : undefined, + }); } else { this.connection.cacheNote(note); this.send('note', note); diff --git a/packages/backend/src/server/api/stream/channels/local-timeline.ts b/packages/backend/src/server/api/stream/channels/local-timeline.ts index 441b0132a..eae05fca6 100644 --- a/packages/backend/src/server/api/stream/channels/local-timeline.ts +++ b/packages/backend/src/server/api/stream/channels/local-timeline.ts @@ -19,7 +19,7 @@ class LocalTimelineChannel extends Channel { private withRenotes: boolean; private withReplies: boolean; private withFiles: boolean; - private idOnly: boolean; + private minimize: boolean; constructor( private metaService: MetaService, @@ -41,7 +41,7 @@ class LocalTimelineChannel extends Channel { this.withRenotes = params.withRenotes ?? true; this.withReplies = params.withReplies ?? false; this.withFiles = params.withFiles ?? false; - this.idOnly = params.idOnly ?? false; + this.minimize = params.minimize ?? false; // Subscribe events this.subscriber.on('notesStream', this.onNote); @@ -90,9 +90,13 @@ class LocalTimelineChannel extends Channel { } } - if (this.idOnly && ['public', 'home'].includes(note.visibility)) { - const idOnlyNote = { id: note.id }; - this.send('note', idOnlyNote); + if (this.minimize && ['public', 'home'].includes(note.visibility)) { + this.send('note', { + id: note.id, myReaction: note.myReaction, + poll: note.poll ? { choices: note.poll.choices } : undefined, + reply: note.reply ? { myReaction: note.reply.myReaction } : undefined, + renote: note.renote ? { myReaction: note.renote.myReaction } : undefined, + }); } else { this.connection.cacheNote(note); this.send('note', note); diff --git a/packages/backend/src/server/api/stream/channels/role-timeline.ts b/packages/backend/src/server/api/stream/channels/role-timeline.ts index 3fb888571..746608c27 100644 --- a/packages/backend/src/server/api/stream/channels/role-timeline.ts +++ b/packages/backend/src/server/api/stream/channels/role-timeline.ts @@ -16,7 +16,7 @@ class RoleTimelineChannel extends Channel { public static readonly shouldShare = false; public static readonly requireCredential = false as const; private roleId: string; - private idOnly: boolean; + private minimize: boolean; constructor( private noteEntityService: NoteEntityService, @@ -32,7 +32,7 @@ class RoleTimelineChannel extends Channel { @bindThis public async init(params: any) { this.roleId = params.roleId as string; - this.idOnly = params.idOnly ?? false; + this.minimize = params.minimize ?? false; this.subscriber.on(`roleTimelineStream:${this.roleId}`, this.onEvent); } @@ -73,9 +73,13 @@ class RoleTimelineChannel extends Channel { } } - if (this.idOnly && ['public', 'home'].includes(note.visibility)) { - const idOnlyNote = { id: note.id }; - this.send('note', idOnlyNote); + if (this.minimize && ['public', 'home'].includes(note.visibility)) { + this.send('note', { + id: note.id, myReaction: note.myReaction, + poll: note.poll ? { choices: note.poll.choices } : undefined, + reply: note.reply ? { myReaction: note.reply.myReaction } : undefined, + renote: note.renote ? { myReaction: note.renote.myReaction } : undefined, + }); } else { this.connection.cacheNote(note); this.send('note', note); diff --git a/packages/backend/src/server/api/stream/channels/user-list.ts b/packages/backend/src/server/api/stream/channels/user-list.ts index 651ab05f3..3faeaddc7 100644 --- a/packages/backend/src/server/api/stream/channels/user-list.ts +++ b/packages/backend/src/server/api/stream/channels/user-list.ts @@ -21,7 +21,7 @@ class UserListChannel extends Channel { private listUsersClock: NodeJS.Timeout; private withFiles: boolean; private withRenotes: boolean; - private idOnly: boolean; + private minimize: boolean; constructor( private userListsRepository: UserListsRepository, @@ -41,7 +41,7 @@ class UserListChannel extends Channel { this.listId = params.listId as string; this.withFiles = params.withFiles ?? false; this.withRenotes = params.withRenotes ?? true; - this.idOnly = params.idOnly ?? false; + this.minimize = params.minimize ?? false; // Check existence and owner const listExist = await this.userListsRepository.exists({ @@ -130,9 +130,13 @@ class UserListChannel extends Channel { } } - if (this.idOnly && ['public', 'home'].includes(note.visibility)) { - const idOnlyNote = { id: note.id }; - this.send('note', idOnlyNote); + if (this.minimize && ['public', 'home'].includes(note.visibility)) { + this.send('note', { + id: note.id, myReaction: note.myReaction, + poll: note.poll ? { choices: note.poll.choices } : undefined, + reply: note.reply ? { myReaction: note.reply.myReaction } : undefined, + renote: note.renote ? { myReaction: note.renote.myReaction } : undefined, + }); } else { this.connection.cacheNote(note); this.send('note', note); diff --git a/packages/backend/test/utils.ts b/packages/backend/test/utils.ts index 6ef69f4d3..573cafad6 100644 --- a/packages/backend/test/utils.ts +++ b/packages/backend/test/utils.ts @@ -400,7 +400,7 @@ export const waitFire = async (user: UserToken if (timer) clearTimeout(timer); res(true); } - }, { ...params, idOnly: false }); + }, { ...params, minimize: false }); } catch (e) { rej(e); } diff --git a/packages/frontend/src/components/MkTimeline.vue b/packages/frontend/src/components/MkTimeline.vue index 9c7e4587d..cf451d4a0 100644 --- a/packages/frontend/src/components/MkTimeline.vue +++ b/packages/frontend/src/components/MkTimeline.vue @@ -18,12 +18,12 @@ SPDX-License-Identifier: AGPL-3.0-only