diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2019-04-18 19:40:23 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2019-04-18 19:40:23 +0900 |
| commit | 7827aeb6951bfd0dae1799601dff3f207a3d2363 (patch) | |
| tree | fa81558061c2743bc5d6566d916f7df4a3dad34e /src/client/app/desktop | |
| parent | Fix API definition (diff) | |
| download | misskey-7827aeb6951bfd0dae1799601dff3f207a3d2363.tar.gz misskey-7827aeb6951bfd0dae1799601dff3f207a3d2363.tar.bz2 misskey-7827aeb6951bfd0dae1799601dff3f207a3d2363.zip | |
Resolve #4735
Diffstat (limited to 'src/client/app/desktop')
| -rw-r--r-- | src/client/app/desktop/views/components/ui.header.search.vue | 27 | ||||
| -rw-r--r-- | src/client/app/desktop/views/home/timeline.core.vue | 15 |
2 files changed, 16 insertions, 26 deletions
diff --git a/src/client/app/desktop/views/components/ui.header.search.vue b/src/client/app/desktop/views/components/ui.header.search.vue index 4ade74bc64..0cf5ca6f32 100644 --- a/src/client/app/desktop/views/components/ui.header.search.vue +++ b/src/client/app/desktop/views/components/ui.header.search.vue @@ -9,6 +9,7 @@ <script lang="ts"> import Vue from 'vue'; import i18n from '../../../i18n'; +import { search } from '../../../common/scripts/search'; export default Vue.extend({ i18n: i18n('desktop/views/components/ui.header.search.vue'), @@ -22,29 +23,11 @@ export default Vue.extend({ async onSubmit() { if (this.wait) return; - const q = this.q.trim(); - if (q.startsWith('@')) { - this.$router.push(`/${q}`); - } else if (q.startsWith('#')) { - this.$router.push(`/tags/${encodeURIComponent(q.substr(1))}`); - } else if (q.startsWith('https://')) { - this.wait = true; - try { - const res = await this.$root.api('ap/show', { - uri: q - }); - if (res.type == 'User') { - this.$router.push(`/@${res.object.username}@${res.object.host}`); - } else if (res.type == 'Note') { - this.$router.push(`/notes/${res.object.id}`); - } - } catch (e) { - // TODO - } + this.wait = true; + search(this, this.q).finally(() => { this.wait = false; - } else { - this.$router.push(`/search?q=${encodeURIComponent(q)}`); - } + this.q = ''; + }); } } }); diff --git a/src/client/app/desktop/views/home/timeline.core.vue b/src/client/app/desktop/views/home/timeline.core.vue index 12806365d4..654a1cc434 100644 --- a/src/client/app/desktop/views/home/timeline.core.vue +++ b/src/client/app/desktop/views/home/timeline.core.vue @@ -53,6 +53,12 @@ export default Vue.extend({ }, created() { + this.$root.$on('warp', this.warp); + this.$once('hook:beforeDestroy', () => { + this.$root.$off('warp', this.warp); + this.connection.dispose(); + }); + const prepend = note => { (this.$refs.timeline as any).prepend(note); }; @@ -124,13 +130,14 @@ export default Vue.extend({ }); }, - beforeDestroy() { - this.connection.dispose(); - }, - methods: { focus() { (this.$refs.timeline as any).focus(); + }, + + warp(date) { + this.date = date; + (this.$refs.timeline as any).reload(); } } }); |