From ea27483f2728b5c2f1dd57228b8bf1ab9ae223ff Mon Sep 17 00:00:00 2001 From: jasper Date: Wed, 3 Apr 2019 09:04:46 -0700 Subject: Fix notification bugs --- src/components/notifications/notifications.js | 7 ------- 1 file changed, 7 deletions(-) (limited to 'src/components') diff --git a/src/components/notifications/notifications.js b/src/components/notifications/notifications.js index d3db4b29..d9ce7604 100644 --- a/src/components/notifications/notifications.js +++ b/src/components/notifications/notifications.js @@ -10,13 +10,6 @@ const Notifications = { props: [ 'noHeading' ], - created () { - const store = this.$store - const credentials = store.state.users.currentUser.credentials - - const fetcherId = notificationsFetcher.startFetching({ store, credentials }) - this.$store.commit('setNotificationFetcher', { fetcherId }) - }, data () { return { bottomedOut: false -- cgit v1.2.3-70-g09d2 From a1275be4c0c83dc848e402bb631990d0cb27bb8c Mon Sep 17 00:00:00 2001 From: jasper Date: Thu, 4 Apr 2019 09:03:56 -0700 Subject: Separate timeline and notification --- .../public_and_external_timeline.js | 2 +- src/components/public_timeline/public_timeline.js | 2 +- src/components/tag_timeline/tag_timeline.js | 4 ++-- src/components/user_profile/user_profile.js | 6 ++--- src/modules/api.js | 27 ++++++++++++++-------- src/modules/users.js | 4 ++-- .../backend_interactor_service.js | 12 ++++++---- 7 files changed, 34 insertions(+), 23 deletions(-) (limited to 'src/components') diff --git a/src/components/public_and_external_timeline/public_and_external_timeline.js b/src/components/public_and_external_timeline/public_and_external_timeline.js index d45677e0..f614c13b 100644 --- a/src/components/public_and_external_timeline/public_and_external_timeline.js +++ b/src/components/public_and_external_timeline/public_and_external_timeline.js @@ -7,7 +7,7 @@ const PublicAndExternalTimeline = { timeline () { return this.$store.state.statuses.timelines.publicAndExternal } }, created () { - this.$store.dispatch('startFetching', { timeline: 'publicAndExternal' }) + this.$store.dispatch('startFetchingTimeline', { timeline: 'publicAndExternal' }) }, destroyed () { this.$store.dispatch('stopFetching', 'publicAndExternal') diff --git a/src/components/public_timeline/public_timeline.js b/src/components/public_timeline/public_timeline.js index 64c951ac..8976a99c 100644 --- a/src/components/public_timeline/public_timeline.js +++ b/src/components/public_timeline/public_timeline.js @@ -7,7 +7,7 @@ const PublicTimeline = { timeline () { return this.$store.state.statuses.timelines.public } }, created () { - this.$store.dispatch('startFetching', { timeline: 'public' }) + this.$store.dispatch('startFetchingTimeline', { timeline: 'public' }) }, destroyed () { this.$store.dispatch('stopFetching', 'public') diff --git a/src/components/tag_timeline/tag_timeline.js b/src/components/tag_timeline/tag_timeline.js index 41b09706..458eb1c5 100644 --- a/src/components/tag_timeline/tag_timeline.js +++ b/src/components/tag_timeline/tag_timeline.js @@ -3,7 +3,7 @@ import Timeline from '../timeline/timeline.vue' const TagTimeline = { created () { this.$store.commit('clearTimeline', { timeline: 'tag' }) - this.$store.dispatch('startFetching', { timeline: 'tag', tag: this.tag }) + this.$store.dispatch('startFetchingTimeline', { timeline: 'tag', tag: this.tag }) }, components: { Timeline @@ -15,7 +15,7 @@ const TagTimeline = { watch: { tag () { this.$store.commit('clearTimeline', { timeline: 'tag' }) - this.$store.dispatch('startFetching', { timeline: 'tag', tag: this.tag }) + this.$store.dispatch('startFetchingTimeline', { timeline: 'tag', tag: this.tag }) } }, destroyed () { diff --git a/src/components/user_profile/user_profile.js b/src/components/user_profile/user_profile.js index 1df06fe6..bac729c0 100644 --- a/src/components/user_profile/user_profile.js +++ b/src/components/user_profile/user_profile.js @@ -90,7 +90,7 @@ const UserProfile = { methods: { startFetchFavorites () { if (this.isUs) { - this.$store.dispatch('startFetching', { timeline: 'favorites', userId: this.userId }) + this.$store.dispatch('startFetchingTimeline', { timeline: 'favorites', userId: this.userId }) } }, fetchUserId () { @@ -118,8 +118,8 @@ const UserProfile = { }, startUp () { if (this.userId) { - this.$store.dispatch('startFetching', { timeline: 'user', userId: this.userId }) - this.$store.dispatch('startFetching', { timeline: 'media', userId: this.userId }) + this.$store.dispatch('startFetchingTimeline', { timeline: 'user', userId: this.userId }) + this.$store.dispatch('startFetchingTimeline', { timeline: 'media', userId: this.userId }) this.startFetchFavorites() } }, diff --git a/src/modules/api.js b/src/modules/api.js index 31cb55c6..6242dfa1 100644 --- a/src/modules/api.js +++ b/src/modules/api.js @@ -13,11 +13,11 @@ const api = { setBackendInteractor (state, backendInteractor) { state.backendInteractor = backendInteractor }, - addFetcher (state, {timeline, fetcher}) { - state.fetchers[timeline] = fetcher + addFetcher (state, {fetcherName, fetcher}) { + state.fetchers[fetcherName] = fetcher }, - removeFetcher (state, {timeline}) { - delete state.fetchers[timeline] + removeFetcher (state, { fetcherName }) { + delete state.fetchers[fetcherName] }, setWsToken (state, token) { state.wsToken = token @@ -33,17 +33,24 @@ const api = { } }, actions: { - startFetching (store, {timeline = 'friends', tag = false, userId = false}) { + startFetchingTimeline (store, {timeline = 'friends', tag = false, userId = false}) { // Don't start fetching if we already are. if (store.state.fetchers[timeline]) return - const fetcher = store.state.backendInteractor.startFetching({ timeline, store, userId, tag }) - store.commit('addFetcher', { timeline, fetcher }) + const fetcher = store.state.backendInteractor.startFetchingTimeline({ timeline, store, userId, tag }) + store.commit('addFetcher', { fetcherName: timeline, fetcher }) }, - stopFetching (store, timeline) { - const fetcher = store.state.fetchers[timeline] + startFetchingNotifications (store) { + // Don't start fetching if we already are. + if (store.state.fetchers['notifications']) return + + const fetcher = store.state.backendInteractor.startFetchingNotifications({ store }) + store.commit('addFetcher', { fetcherName: 'notifications', fetcher }) + }, + stopFetching (store, fetcherName) { + const fetcher = store.state.fetchers[fetcherName] window.clearInterval(fetcher) - store.commit('removeFetcher', {timeline}) + store.commit('removeFetcher', { fetcherName }) }, setWsToken (store, token) { store.commit('setWsToken', token) diff --git a/src/modules/users.js b/src/modules/users.js index 3cfae1fc..b0c7f2f6 100644 --- a/src/modules/users.js +++ b/src/modules/users.js @@ -364,10 +364,10 @@ const users = { } // Start getting fresh posts. - store.dispatch('startFetching', { timeline: 'friends' }) + store.dispatch('startFetchingTimeline', { timeline: 'friends' }) // Start fetching notifications - store.dispatch('startFetching', { timeline: 'notifications' }) + store.dispatch('startFetchingNotifications') // Get user mutes store.dispatch('fetchMutes') diff --git a/src/services/backend_interactor_service/backend_interactor_service.js b/src/services/backend_interactor_service/backend_interactor_service.js index f28686f8..7dd139c6 100644 --- a/src/services/backend_interactor_service/backend_interactor_service.js +++ b/src/services/backend_interactor_service/backend_interactor_service.js @@ -59,9 +59,12 @@ const backendInteractorService = (credentials) => { return apiService.denyUser({credentials, id}) } - const startFetching = ({timeline, store, userId = false, tag}) => { - if (timeline === 'notifications') { return notificationsFetcher.startFetching({store, credentials}) } - return timelineFetcherService.startFetching({timeline, store, credentials, userId, tag}) + const startFetchingTimeline = ({ timeline, store, userId = false, tag }) => { + return timelineFetcherService.startFetching({ timeline, store, credentials, userId, tag }) + } + + const startFetchingNotifications = ({ store }) => { + return notificationsFetcher.startFetching({ store, credentials }) } const fetchMutes = () => apiService.fetchMutes({credentials}) @@ -99,7 +102,8 @@ const backendInteractorService = (credentials) => { fetchUserRelationship, fetchAllFollowing, verifyCredentials: apiService.verifyCredentials, - startFetching, + startFetchingTimeline, + startFetchingNotifications, fetchMutes, muteUser, unmuteUser, -- cgit v1.2.3-70-g09d2 From 1570e779b1a3497f29e0681f1390322e8e65030b Mon Sep 17 00:00:00 2001 From: jasper Date: Tue, 9 Apr 2019 08:38:13 -0700 Subject: Prevent repeated fetching --- src/components/timeline/timeline.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/components') diff --git a/src/components/timeline/timeline.js b/src/components/timeline/timeline.js index 1da7d5cc..19d9a9ac 100644 --- a/src/components/timeline/timeline.js +++ b/src/components/timeline/timeline.js @@ -52,7 +52,7 @@ const Timeline = { window.addEventListener('scroll', this.scrollLoad) - if (this.timelineName === 'friends' && !credentials) { return false } + if (store.state.api.fetchers[this.timelineName]) { return false } timelineFetcher.fetchAndUpdate({ store, -- cgit v1.2.3-70-g09d2 From b7d7c216177407e451bbab4a6178016dcd7b805d Mon Sep 17 00:00:00 2001 From: jasper Date: Tue, 9 Apr 2019 08:57:41 -0700 Subject: Add await to login befor redirect to friends timeline --- src/components/login_form/login_form.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/components') diff --git a/src/components/login_form/login_form.js b/src/components/login_form/login_form.js index fb6dc651..e0fbb329 100644 --- a/src/components/login_form/login_form.js +++ b/src/components/login_form/login_form.js @@ -31,14 +31,18 @@ const LoginForm = { username: this.user.username, password: this.user.password } - ).then((result) => { + ).then(async (result) => { if (result.error) { this.authError = result.error this.user.password = '' return } this.$store.commit('setToken', result.access_token) - this.$store.dispatch('loginUser', result.access_token) + try { + await this.$store.dispatch('loginUser', result.access_token) + } catch (e) { + console.log(e) + } this.$router.push({name: 'friends'}) }) }) -- cgit v1.2.3-70-g09d2 From 011f04c196318e25cfff10f3fa41321070511919 Mon Sep 17 00:00:00 2001 From: jasper Date: Tue, 9 Apr 2019 09:19:48 -0700 Subject: fix small bug --- src/components/login_form/login_form.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/components') diff --git a/src/components/login_form/login_form.js b/src/components/login_form/login_form.js index e0fbb329..dc917e47 100644 --- a/src/components/login_form/login_form.js +++ b/src/components/login_form/login_form.js @@ -40,10 +40,10 @@ const LoginForm = { this.$store.commit('setToken', result.access_token) try { await this.$store.dispatch('loginUser', result.access_token) + this.$router.push({name: 'friends'}) } catch (e) { console.log(e) } - this.$router.push({name: 'friends'}) }) }) }, -- cgit v1.2.3-70-g09d2 From 5df049ca3148c1bdf29a5f3ee1a60b7ecf94bb88 Mon Sep 17 00:00:00 2001 From: jared Date: Tue, 9 Apr 2019 14:10:51 -0400 Subject: #486 - remove expand button on conversation page --- src/components/conversation/conversation.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/components') diff --git a/src/components/conversation/conversation.vue b/src/components/conversation/conversation.vue index c39a3ed9..c3bbb597 100644 --- a/src/components/conversation/conversation.vue +++ b/src/components/conversation/conversation.vue @@ -13,7 +13,7 @@ :key="status.id" :inlineExpanded="collapsable" :statusoid="status" - :expandable='!expanded' + :expandable='!isExpanded' :focused="focused(status.id)" :inConversation="isExpanded" :highlight="getHighlight()" -- cgit v1.2.3-70-g09d2