From 790fcf37d223f129640aca20c7e185a26b226cdd Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Mon, 14 Jan 2019 22:38:37 +0300 Subject: notifications now also undergo some parsing, hypothetically could use MastoAPI notifications, maybe. --- src/modules/users.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/modules/users.js') diff --git a/src/modules/users.js b/src/modules/users.js index adbd37dd..33c02a07 100644 --- a/src/modules/users.js +++ b/src/modules/users.js @@ -68,6 +68,7 @@ export const mutations = { }, setUserForNotification (state, notification) { notification.action.user = state.usersObject[notification.action.user.id] + notification.from_profile = state.usersObject[notification.action.user.id] }, setColor (state, { user: { id }, highlighted }) { const user = state.usersObject[id] @@ -149,8 +150,8 @@ const users = { }) }, addNewNotifications (store, { notifications }) { - const users = compact(map(notifications, 'from_profile')) - const notificationIds = compact(notifications.map(_ => String(_.id))) + const users = map(notifications, 'from_profile') + const notificationIds = notifications.map(_ => String(_.id)) store.commit('addNewUsers', users) const notificationsObject = store.rootState.statuses.notifications.idStore -- cgit v1.2.3-70-g09d2 From 93cbb58212ebb83cee5bc89f8cef1ebb58969f5c Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Thu, 17 Jan 2019 22:11:51 +0300 Subject: fix login and favorites tab... --- src/components/user_profile/user_profile.js | 13 +++++ src/components/user_profile/user_profile.vue | 2 +- src/modules/users.js | 61 +++++++++++----------- src/services/api/api.service.js | 12 +++++ .../entity_normalizer/entity_normalizer.service.js | 8 +++ 5 files changed, 64 insertions(+), 32 deletions(-) (limited to 'src/modules/users.js') diff --git a/src/components/user_profile/user_profile.js b/src/components/user_profile/user_profile.js index 7f17ef69..c9197a1c 100644 --- a/src/components/user_profile/user_profile.js +++ b/src/components/user_profile/user_profile.js @@ -5,13 +5,16 @@ import Timeline from '../timeline/timeline.vue' const UserProfile = { created () { this.$store.commit('clearTimeline', { timeline: 'user' }) + this.$store.commit('clearTimeline', { timeline: 'favorites' }) this.$store.dispatch('startFetching', ['user', this.fetchBy]) + this.$store.dispatch('startFetching', ['favorites', this.fetchBy]) if (!this.user.id) { this.$store.dispatch('fetchUser', this.fetchBy) } }, destroyed () { this.$store.dispatch('stopFetching', 'user') + this.$store.dispatch('stopFetching', 'favorites') }, computed: { timeline () { @@ -26,6 +29,9 @@ const UserProfile = { userName () { return this.$route.params.name || this.user.screen_name }, + isUs () { + return this.userId === this.$store.state.users.currentUser.id + }, friends () { return this.user.friends }, @@ -65,21 +71,28 @@ const UserProfile = { } }, watch: { + // TODO get rid of this copypasta userName () { if (this.isExternal) { return } this.$store.dispatch('stopFetching', 'user') + this.$store.dispatch('stopFetching', 'favorites') this.$store.commit('clearTimeline', { timeline: 'user' }) + this.$store.commit('clearTimeline', { timeline: 'favorites' }) this.$store.dispatch('startFetching', ['user', this.fetchBy]) + this.$store.dispatch('startFetching', ['favorites', this.fetchBy]) }, userId () { if (!this.isExternal) { return } this.$store.dispatch('stopFetching', 'user') + this.$store.dispatch('stopFetching', 'favorites') this.$store.commit('clearTimeline', { timeline: 'user' }) + this.$store.commit('clearTimeline', { timeline: 'favorites' }) this.$store.dispatch('startFetching', ['user', this.fetchBy]) + this.$store.dispatch('startFetching', ['favorites', this.fetchBy]) }, user () { if (this.user.id && !this.user.followers) { diff --git a/src/components/user_profile/user_profile.vue b/src/components/user_profile/user_profile.vue index 265fc65b..e53727ff 100644 --- a/src/components/user_profile/user_profile.vue +++ b/src/components/user_profile/user_profile.vue @@ -20,7 +20,7 @@ - +