diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2021-03-19 20:43:24 +0900 |
|---|---|---|
| committer | syuilo <Syuilotan@yahoo.co.jp> | 2021-03-19 20:43:24 +0900 |
| commit | 87c8f9ff953499340496e9c5db09c93eaff08851 (patch) | |
| tree | 13c00ab0edf7bae614216a06a015c9c50b056b83 /src/client/components | |
| parent | perf(server): Improver performance (diff) | |
| download | sharkey-87c8f9ff953499340496e9c5db09c93eaff08851.tar.gz sharkey-87c8f9ff953499340496e9c5db09c93eaff08851.tar.bz2 sharkey-87c8f9ff953499340496e9c5db09c93eaff08851.zip | |
perf: Reduce database query
Diffstat (limited to 'src/client/components')
| -rw-r--r-- | src/client/components/note-detailed.vue | 10 | ||||
| -rw-r--r-- | src/client/components/note.vue | 10 |
2 files changed, 18 insertions, 2 deletions
diff --git a/src/client/components/note-detailed.vue b/src/client/components/note-detailed.vue index 1ef3f43389..4ad3d2d898 100644 --- a/src/client/components/note-detailed.vue +++ b/src/client/components/note-detailed.vue @@ -350,7 +350,15 @@ export default defineComponent({ capture(withHandler = false) { if (this.$i) { - this.connection.send(document.body.contains(this.$el) ? 'sn' : 's', { id: this.appearNote.id }); + this.connection.send('sn', { id: this.appearNote.id }); + if (this.appearNote.userId !== this.$i.id) { + if (this.appearNote.mentions && this.appearNote.mentions.includes(this.$i.id)) { + this.connection.send('readMention', { id: this.appearNote.id }); + } + if (this.appearNote.visibleUserIds && this.appearNote.visibleUserIds.includes(this.$i.id)) { + this.connection.send('readSpecifiedNote', { id: this.appearNote.id }); + } + } if (withHandler) this.connection.on('noteUpdated', this.onStreamNoteUpdated); } }, diff --git a/src/client/components/note.vue b/src/client/components/note.vue index 65e09b7802..3b59afd71d 100644 --- a/src/client/components/note.vue +++ b/src/client/components/note.vue @@ -325,7 +325,15 @@ export default defineComponent({ capture(withHandler = false) { if (this.$i) { - this.connection.send(document.body.contains(this.$el) ? 'sn' : 's', { id: this.appearNote.id }); + this.connection.send('sn', { id: this.appearNote.id }); + if (this.appearNote.userId !== this.$i.id) { + if (this.appearNote.mentions && this.appearNote.mentions.includes(this.$i.id)) { + this.connection.send('readMention', { id: this.appearNote.id }); + } + if (this.appearNote.visibleUserIds && this.appearNote.visibleUserIds.includes(this.$i.id)) { + this.connection.send('readSpecifiedNote', { id: this.appearNote.id }); + } + } if (withHandler) this.connection.on('noteUpdated', this.onStreamNoteUpdated); } }, |