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

This commit is contained in:
あわわわとーにゅ 2024-12-25 15:40:37 +09:00 committed by GitHub
parent 84505cb7ad
commit 7bbbbd0b89
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 24 additions and 24 deletions

View file

@ -54,9 +54,9 @@ class AntennaChannel extends Channel {
if (this.minimize && ['public', 'home'].includes(note.visibility)) { if (this.minimize && ['public', 'home'].includes(note.visibility)) {
this.send('note', { this.send('note', {
id: note.id, myReaction: note.myReaction, id: note.id, myReaction: note.myReaction,
poll: note.poll ? { choices: note.poll.choices } : undefined, poll: note.poll?.choices ? { choices: note.poll.choices } : undefined,
reply: note.reply ? { myReaction: note.reply.myReaction } : undefined, reply: note.reply?.myReaction ? { myReaction: note.reply.myReaction } : undefined,
renote: note.renote ? { myReaction: note.renote.myReaction } : undefined, renote: note.renote?.myReaction ? { myReaction: note.renote.myReaction } : undefined,
}); });
} else { } else {
this.connection.cacheNote(note); this.connection.cacheNote(note);

View file

@ -60,9 +60,9 @@ class ChannelChannel extends Channel {
if (this.minimize && ['public', 'home'].includes(note.visibility)) { if (this.minimize && ['public', 'home'].includes(note.visibility)) {
this.send('note', { this.send('note', {
id: note.id, myReaction: note.myReaction, id: note.id, myReaction: note.myReaction,
poll: note.poll ? { choices: note.poll.choices } : undefined, poll: note.poll?.choices ? { choices: note.poll.choices } : undefined,
reply: note.reply ? { myReaction: note.reply.myReaction } : undefined, reply: note.reply?.myReaction ? { myReaction: note.reply.myReaction } : undefined,
renote: note.renote ? { myReaction: note.renote.myReaction } : undefined, renote: note.renote?.myReaction ? { myReaction: note.renote.myReaction } : undefined,
}); });
} else { } else {
this.connection.cacheNote(note); this.connection.cacheNote(note);

View file

@ -90,9 +90,9 @@ class GlobalTimelineChannel extends Channel {
if (this.minimize && ['public', 'home'].includes(note.visibility)) { if (this.minimize && ['public', 'home'].includes(note.visibility)) {
this.send('note', { this.send('note', {
id: note.id, myReaction: note.myReaction, id: note.id, myReaction: note.myReaction,
poll: note.poll ? { choices: note.poll.choices } : undefined, poll: note.poll?.choices ? { choices: note.poll.choices } : undefined,
reply: note.reply ? { myReaction: note.reply.myReaction } : undefined, reply: note.reply?.myReaction ? { myReaction: note.reply.myReaction } : undefined,
renote: note.renote ? { myReaction: note.renote.myReaction } : undefined, renote: note.renote?.myReaction ? { myReaction: note.renote.myReaction } : undefined,
}); });
} else { } else {
this.connection.cacheNote(note); this.connection.cacheNote(note);

View file

@ -94,9 +94,9 @@ class HomeTimelineChannel extends Channel {
if (this.minimize && ['public', 'home'].includes(note.visibility)) { if (this.minimize && ['public', 'home'].includes(note.visibility)) {
this.send('note', { this.send('note', {
id: note.id, myReaction: note.myReaction, id: note.id, myReaction: note.myReaction,
poll: note.poll ? { choices: note.poll.choices } : undefined, poll: note.poll?.choices ? { choices: note.poll.choices } : undefined,
reply: note.reply ? { myReaction: note.reply.myReaction } : undefined, reply: note.reply?.myReaction ? { myReaction: note.reply.myReaction } : undefined,
renote: note.renote ? { myReaction: note.renote.myReaction } : undefined, renote: note.renote?.myReaction ? { myReaction: note.renote.myReaction } : undefined,
}); });
} else { } else {
this.connection.cacheNote(note); this.connection.cacheNote(note);

View file

@ -108,9 +108,9 @@ class HybridTimelineChannel extends Channel {
if (this.minimize && ['public', 'home'].includes(note.visibility)) { if (this.minimize && ['public', 'home'].includes(note.visibility)) {
this.send('note', { this.send('note', {
id: note.id, myReaction: note.myReaction, id: note.id, myReaction: note.myReaction,
poll: note.poll ? { choices: note.poll.choices } : undefined, poll: note.poll?.choices ? { choices: note.poll.choices } : undefined,
reply: note.reply ? { myReaction: note.reply.myReaction } : undefined, reply: note.reply?.myReaction ? { myReaction: note.reply.myReaction } : undefined,
renote: note.renote ? { myReaction: note.renote.myReaction } : undefined, renote: note.renote?.myReaction ? { myReaction: note.renote.myReaction } : undefined,
}); });
} else { } else {
this.connection.cacheNote(note); this.connection.cacheNote(note);

View file

@ -93,9 +93,9 @@ class LocalTimelineChannel extends Channel {
if (this.minimize && ['public', 'home'].includes(note.visibility)) { if (this.minimize && ['public', 'home'].includes(note.visibility)) {
this.send('note', { this.send('note', {
id: note.id, myReaction: note.myReaction, id: note.id, myReaction: note.myReaction,
poll: note.poll ? { choices: note.poll.choices } : undefined, poll: note.poll?.choices ? { choices: note.poll.choices } : undefined,
reply: note.reply ? { myReaction: note.reply.myReaction } : undefined, reply: note.reply?.myReaction ? { myReaction: note.reply.myReaction } : undefined,
renote: note.renote ? { myReaction: note.renote.myReaction } : undefined, renote: note.renote?.myReaction ? { myReaction: note.renote.myReaction } : undefined,
}); });
} else { } else {
this.connection.cacheNote(note); this.connection.cacheNote(note);

View file

@ -76,9 +76,9 @@ class RoleTimelineChannel extends Channel {
if (this.minimize && ['public', 'home'].includes(note.visibility)) { if (this.minimize && ['public', 'home'].includes(note.visibility)) {
this.send('note', { this.send('note', {
id: note.id, myReaction: note.myReaction, id: note.id, myReaction: note.myReaction,
poll: note.poll ? { choices: note.poll.choices } : undefined, poll: note.poll?.choices ? { choices: note.poll.choices } : undefined,
reply: note.reply ? { myReaction: note.reply.myReaction } : undefined, reply: note.reply?.myReaction ? { myReaction: note.reply.myReaction } : undefined,
renote: note.renote ? { myReaction: note.renote.myReaction } : undefined, renote: note.renote?.myReaction ? { myReaction: note.renote.myReaction } : undefined,
}); });
} else { } else {
this.connection.cacheNote(note); this.connection.cacheNote(note);

View file

@ -133,9 +133,9 @@ class UserListChannel extends Channel {
if (this.minimize && ['public', 'home'].includes(note.visibility)) { if (this.minimize && ['public', 'home'].includes(note.visibility)) {
this.send('note', { this.send('note', {
id: note.id, myReaction: note.myReaction, id: note.id, myReaction: note.myReaction,
poll: note.poll ? { choices: note.poll.choices } : undefined, poll: note.poll?.choices ? { choices: note.poll.choices } : undefined,
reply: note.reply ? { myReaction: note.reply.myReaction } : undefined, reply: note.reply?.myReaction ? { myReaction: note.reply.myReaction } : undefined,
renote: note.renote ? { myReaction: note.renote.myReaction } : undefined, renote: note.renote?.myReaction ? { myReaction: note.renote.myReaction } : undefined,
}); });
} else { } else {
this.connection.cacheNote(note); this.connection.cacheNote(note);