From 1b2200ccf463578103ba3bcc24e29f5fdcc2ee49 Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 21 May 2019 08:10:37 +0900 Subject: [PATCH] Refactyor --- .../common/views/deck/deck.direct-column.vue | 41 +++++++++++++-- .../app/common/views/deck/deck.direct.vue | 52 ------------------- .../views/deck/deck.mentions-column.vue | 38 ++++++++++++-- .../app/common/views/deck/deck.mentions.vue | 49 ----------------- 4 files changed, 71 insertions(+), 109 deletions(-) delete mode 100644 src/client/app/common/views/deck/deck.direct.vue delete mode 100644 src/client/app/common/views/deck/deck.mentions.vue diff --git a/src/client/app/common/views/deck/deck.direct-column.vue b/src/client/app/common/views/deck/deck.direct-column.vue index c68a361a9f..66d34520af 100644 --- a/src/client/app/common/views/deck/deck.direct-column.vue +++ b/src/client/app/common/views/deck/deck.direct-column.vue @@ -2,7 +2,7 @@ - + @@ -10,13 +10,14 @@ import Vue from 'vue'; import i18n from '../../../i18n'; import XColumn from './deck.column.vue'; -import XDirect from './deck.direct.vue'; +import XNotes from './deck.notes.vue'; export default Vue.extend({ i18n: i18n(), + components: { XColumn, - XDirect + XNotes }, props: { @@ -30,6 +31,22 @@ export default Vue.extend({ } }, + data() { + return { + connection: null, + pagination: { + endpoint: 'notes/mentions', + limit: 10, + params: { + includeMyRenotes: this.$store.state.settings.showMyRenotes, + includeRenotedMyNotes: this.$store.state.settings.showRenotedMyNotes, + includeLocalRenotes: this.$store.state.settings.showLocalRenotes, + visibility: 'specified' + } + } + }; + }, + computed: { name(): string { if (this.column.name) return this.column.name; @@ -37,9 +54,25 @@ export default Vue.extend({ } }, + mounted() { + this.connection = this.$root.stream.useSharedConnection('main'); + this.connection.on('mention', this.onNote); + }, + + beforeDestroy() { + this.connection.dispose(); + }, + methods: { + onNote(note) { + // Prepend a note + if (note.visibility == 'specified') { + (this.$refs.timeline as any).prepend(note); + } + }, + focus() { - this.$refs.tl.focus(); + this.$refs.timeline.focus(); } } }); diff --git a/src/client/app/common/views/deck/deck.direct.vue b/src/client/app/common/views/deck/deck.direct.vue deleted file mode 100644 index 24d61be494..0000000000 --- a/src/client/app/common/views/deck/deck.direct.vue +++ /dev/null @@ -1,52 +0,0 @@ - - - diff --git a/src/client/app/common/views/deck/deck.mentions-column.vue b/src/client/app/common/views/deck/deck.mentions-column.vue index b7f3290d0d..12d7b2a16b 100644 --- a/src/client/app/common/views/deck/deck.mentions-column.vue +++ b/src/client/app/common/views/deck/deck.mentions-column.vue @@ -2,7 +2,7 @@ - + @@ -10,13 +10,14 @@ import Vue from 'vue'; import i18n from '../../../i18n'; import XColumn from './deck.column.vue'; -import XMentions from './deck.mentions.vue'; +import XNotes from './deck.notes.vue'; export default Vue.extend({ i18n: i18n(), + components: { XColumn, - XMentions + XNotes }, props: { @@ -30,6 +31,22 @@ export default Vue.extend({ } }, + data() { + return { + connection: null, + pagination: { + endpoint: 'notes/mentions', + limit: 10, + params: init => ({ + untilDate: init ? undefined : (this.date ? this.date.getTime() : undefined), + includeMyRenotes: this.$store.state.settings.showMyRenotes, + includeRenotedMyNotes: this.$store.state.settings.showRenotedMyNotes, + includeLocalRenotes: this.$store.state.settings.showLocalRenotes + }) + } + }; + }, + computed: { name(): string { if (this.column.name) return this.column.name; @@ -37,9 +54,22 @@ export default Vue.extend({ } }, + mounted() { + this.connection = this.$root.stream.useSharedConnection('main'); + this.connection.on('mention', this.onNote); + }, + + beforeDestroy() { + this.connection.dispose(); + }, + methods: { + onNote(note) { + (this.$refs.timeline as any).prepend(note); + }, + focus() { - this.$refs.tl.focus(); + this.$refs.timeline.focus(); } } }); diff --git a/src/client/app/common/views/deck/deck.mentions.vue b/src/client/app/common/views/deck/deck.mentions.vue deleted file mode 100644 index 8b65bdfd2d..0000000000 --- a/src/client/app/common/views/deck/deck.mentions.vue +++ /dev/null @@ -1,49 +0,0 @@ - - -