From 642b0be0b2c82e7c9c1bb45c50e60b2d3b4090f8 Mon Sep 17 00:00:00 2001 From: Edijs Date: Sun, 17 Feb 2019 14:31:13 -0700 Subject: Bind a keyboard to show new status --- src/components/timeline/timeline.js | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/components/timeline') diff --git a/src/components/timeline/timeline.js b/src/components/timeline/timeline.js index 85e0a055..a8a3495a 100644 --- a/src/components/timeline/timeline.js +++ b/src/components/timeline/timeline.js @@ -67,6 +67,9 @@ const Timeline = { document.addEventListener('visibilitychange', this.handleVisibilityChange, false) this.unfocused = document.hidden } + window.addEventListener('keydown', e => { + if (e.key === '.') this.showNewStatuses() + }) }, destroyed () { window.removeEventListener('scroll', this.scrollLoad) -- cgit v1.2.3-70-g09d2 From 0d2922afb3bcfcdcc439f158d147db1f08d995c7 Mon Sep 17 00:00:00 2001 From: Edijs Date: Sun, 17 Feb 2019 14:37:24 -0700 Subject: Remove event listener when component destroy --- src/components/timeline/timeline.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/components/timeline') diff --git a/src/components/timeline/timeline.js b/src/components/timeline/timeline.js index a8a3495a..d7f7029e 100644 --- a/src/components/timeline/timeline.js +++ b/src/components/timeline/timeline.js @@ -67,16 +67,18 @@ const Timeline = { document.addEventListener('visibilitychange', this.handleVisibilityChange, false) this.unfocused = document.hidden } - window.addEventListener('keydown', e => { - if (e.key === '.') this.showNewStatuses() - }) + window.addEventListener('keydown', this.handleShortKey) }, destroyed () { window.removeEventListener('scroll', this.scrollLoad) + window.removeEventListener('keydown', this.handleShortKey) if (typeof document.hidden !== 'undefined') document.removeEventListener('visibilitychange', this.handleVisibilityChange, false) this.$store.commit('setLoading', { timeline: this.timelineName, value: false }) }, methods: { + handleShortKey (e) { + if (e.key === '.') this.showNewStatuses() + }, showNewStatuses () { if (this.timeline.flushMarker !== 0) { this.$store.commit('clearTimeline', { timeline: this.timelineName }) -- cgit v1.2.3-70-g09d2 From d4a2376e12cd9a05e29bf8eb55d7388598ed1137 Mon Sep 17 00:00:00 2001 From: jasper Date: Mon, 18 Feb 2019 12:32:08 -0800 Subject: fix/fetch-error-when-login --- src/components/timeline/timeline.js | 13 ------------- 1 file changed, 13 deletions(-) (limited to 'src/components/timeline') diff --git a/src/components/timeline/timeline.js b/src/components/timeline/timeline.js index 85e0a055..40b42d50 100644 --- a/src/components/timeline/timeline.js +++ b/src/components/timeline/timeline.js @@ -47,20 +47,7 @@ const Timeline = { UserCard }, created () { - const store = this.$store - const credentials = store.state.users.currentUser.credentials - const showImmediately = this.timeline.visibleStatuses.length === 0 - window.addEventListener('scroll', this.scrollLoad) - - timelineFetcher.fetchAndUpdate({ - store, - credentials, - timeline: this.timelineName, - showImmediately, - userId: this.userId, - tag: this.tag - }) }, mounted () { if (typeof document.hidden !== 'undefined') { -- cgit v1.2.3-70-g09d2 From b4709515f22446b032c664e0960419ebea119098 Mon Sep 17 00:00:00 2001 From: jasper Date: Mon, 18 Feb 2019 17:15:16 -0800 Subject: Fix error when login --- src/components/timeline/timeline.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/components/timeline') diff --git a/src/components/timeline/timeline.js b/src/components/timeline/timeline.js index 40b42d50..3fc927f9 100644 --- a/src/components/timeline/timeline.js +++ b/src/components/timeline/timeline.js @@ -47,7 +47,22 @@ const Timeline = { UserCard }, created () { + const store = this.$store + const credentials = store.state.users.currentUser.credentials + const showImmediately = this.timeline.visibleStatuses.length === 0 + window.addEventListener('scroll', this.scrollLoad) + + if (typeof credentials !== 'undefined' || this.timelineName !== 'friends') { + timelineFetcher.fetchAndUpdate({ + store, + credentials, + timeline: this.timelineName, + showImmediately, + userId: this.userId, + tag: this.tag + }) + } }, mounted () { if (typeof document.hidden !== 'undefined') { -- cgit v1.2.3-70-g09d2 From d032ce2758cb57ea34e1fea2d1804656965b635e Mon Sep 17 00:00:00 2001 From: Edijs Date: Mon, 18 Feb 2019 18:32:20 -0700 Subject: Validate if there are any new status to show --- src/components/timeline/timeline.js | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/components/timeline') diff --git a/src/components/timeline/timeline.js b/src/components/timeline/timeline.js index d7f7029e..06832898 100644 --- a/src/components/timeline/timeline.js +++ b/src/components/timeline/timeline.js @@ -80,6 +80,8 @@ const Timeline = { if (e.key === '.') this.showNewStatuses() }, showNewStatuses () { + if (this.newStatusCount === 0) return + if (this.timeline.flushMarker !== 0) { this.$store.commit('clearTimeline', { timeline: this.timelineName }) this.$store.commit('queueFlush', { timeline: this.timelineName, id: 0 }) -- cgit v1.2.3-70-g09d2 From 1e43a47c3c922c4b68e0a84b74cafe6a2ea23bf1 Mon Sep 17 00:00:00 2001 From: jasper Date: Tue, 19 Feb 2019 09:42:53 -0800 Subject: Update: Fix fetch error when login --- src/components/timeline/timeline.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/components/timeline') diff --git a/src/components/timeline/timeline.js b/src/components/timeline/timeline.js index 3fc927f9..ee4ec10b 100644 --- a/src/components/timeline/timeline.js +++ b/src/components/timeline/timeline.js @@ -53,16 +53,16 @@ const Timeline = { window.addEventListener('scroll', this.scrollLoad) - if (typeof credentials !== 'undefined' || this.timelineName !== 'friends') { - timelineFetcher.fetchAndUpdate({ - store, - credentials, - timeline: this.timelineName, - showImmediately, - userId: this.userId, - tag: this.tag - }) - } + if (this.timelineName === 'friends' && !credentials) { return false } + + timelineFetcher.fetchAndUpdate({ + store, + credentials, + timeline: this.timelineName, + showImmediately, + userId: this.userId, + tag: this.tag + }) }, mounted () { if (typeof document.hidden !== 'undefined') { -- cgit v1.2.3-70-g09d2 From e20a7be3aa4973400cd670347ff038a78eb12e4e Mon Sep 17 00:00:00 2001 From: dave Date: Wed, 20 Feb 2019 10:13:28 -0500 Subject: #376: update status timeline when it's empty --- src/components/timeline/timeline.js | 3 ++- src/components/timeline/timeline.vue | 5 ++++- src/components/user_profile/user_profile.vue | 1 + src/i18n/en.json | 3 ++- 4 files changed, 9 insertions(+), 3 deletions(-) (limited to 'src/components/timeline') diff --git a/src/components/timeline/timeline.js b/src/components/timeline/timeline.js index 85e0a055..40226674 100644 --- a/src/components/timeline/timeline.js +++ b/src/components/timeline/timeline.js @@ -11,7 +11,8 @@ const Timeline = { 'title', 'userId', 'tag', - 'embedded' + 'embedded', + 'count' ], data () { return { diff --git a/src/components/timeline/timeline.vue b/src/components/timeline/timeline.vue index e3eea3bd..8f28d65c 100644 --- a/src/components/timeline/timeline.vue +++ b/src/components/timeline/timeline.vue @@ -20,7 +20,10 @@
-