enhance(data-usage): ストリーム上で送るデータがない場合はオブジェクトごと省略するように (MisskeyIO#853)

This commit is contained in:
あわわわとーにゅ 2024-12-25 15:40:37 +09:00 committed by kakkokari-gtyih
parent b7d80edcbb
commit 1ea5b86e71
8 changed files with 24 additions and 24 deletions

View File

@ -48,9 +48,9 @@ class AntennaChannel extends Channel {
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,
poll: note.poll?.choices ? { choices: note.poll.choices } : undefined,
reply: note.reply?.myReaction ? { myReaction: note.reply.myReaction } : undefined,
renote: note.renote?.myReaction ? { myReaction: note.renote.myReaction } : undefined,
});
} else {
this.connection.cacheNote(note);

View File

@ -54,9 +54,9 @@ class ChannelChannel extends Channel {
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,
poll: note.poll?.choices ? { choices: note.poll.choices } : undefined,
reply: note.reply?.myReaction ? { myReaction: note.reply.myReaction } : undefined,
renote: note.renote?.myReaction ? { myReaction: note.renote.myReaction } : undefined,
});
} else {
this.connection.cacheNote(note);

View File

@ -67,9 +67,9 @@ class GlobalTimelineChannel extends Channel {
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,
poll: note.poll?.choices ? { choices: note.poll.choices } : undefined,
reply: note.reply?.myReaction ? { myReaction: note.reply.myReaction } : undefined,
renote: note.renote?.myReaction ? { myReaction: note.renote.myReaction } : undefined,
});
} else {
this.connection.cacheNote(note);

View File

@ -91,9 +91,9 @@ class HomeTimelineChannel extends Channel {
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,
poll: note.poll?.choices ? { choices: note.poll.choices } : undefined,
reply: note.reply?.myReaction ? { myReaction: note.reply.myReaction } : undefined,
renote: note.renote?.myReaction ? { myReaction: note.renote.myReaction } : undefined,
});
} else {
this.connection.cacheNote(note);

View File

@ -106,9 +106,9 @@ class HybridTimelineChannel extends Channel {
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,
poll: note.poll?.choices ? { choices: note.poll.choices } : undefined,
reply: note.reply?.myReaction ? { myReaction: note.reply.myReaction } : undefined,
renote: note.renote?.myReaction ? { myReaction: note.renote.myReaction } : undefined,
});
} else {
this.connection.cacheNote(note);

View File

@ -77,9 +77,9 @@ class LocalTimelineChannel extends Channel {
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,
poll: note.poll?.choices ? { choices: note.poll.choices } : undefined,
reply: note.reply?.myReaction ? { myReaction: note.reply.myReaction } : undefined,
renote: note.renote?.myReaction ? { myReaction: note.renote.myReaction } : undefined,
});
} else {
this.connection.cacheNote(note);

View File

@ -53,9 +53,9 @@ class RoleTimelineChannel extends Channel {
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,
poll: note.poll?.choices ? { choices: note.poll.choices } : undefined,
reply: note.reply?.myReaction ? { myReaction: note.reply.myReaction } : undefined,
renote: note.renote?.myReaction ? { myReaction: note.renote.myReaction } : undefined,
});
} else {
this.send('note', note);

View File

@ -123,9 +123,9 @@ class UserListChannel extends Channel {
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,
poll: note.poll?.choices ? { choices: note.poll.choices } : undefined,
reply: note.reply?.myReaction ? { myReaction: note.reply.myReaction } : undefined,
renote: note.renote?.myReaction ? { myReaction: note.renote.myReaction } : undefined,
});
} else {
this.connection.cacheNote(note);