From 6c8ccf2733c780543a9afc5ffbe7942064ad2596 Mon Sep 17 00:00:00 2001 From: jasper Date: Fri, 15 Feb 2019 07:52:34 -0800 Subject: [PATCH] Remove posts immediately by blocking --- .../user_card_content/user_card_content.js | 36 ++++++++++++++++--- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/src/components/user_card_content/user_card_content.js b/src/components/user_card_content/user_card_content.js index 7a7b89d4..41e4e817 100644 --- a/src/components/user_card_content/user_card_content.js +++ b/src/components/user_card_content/user_card_content.js @@ -93,27 +93,55 @@ export default { }, methods: { followUser () { + const store = this.$store this.followRequestInProgress = true - requestFollow(this.user, this.$store).then(({sent}) => { + requestFollow(this.user, store).then(({sent}) => { this.followRequestInProgress = false this.followRequestSent = sent + + store.dispatch('stopFetching', 'friends') + store.commit('clearTimeline', { timeline: 'friends' }) + store.dispatch('startFetching', { timeline: 'friends' }) }) }, unfollowUser () { + const store = this.$store this.followRequestInProgress = true - requestUnfollow(this.user, this.$store).then(() => { + requestUnfollow(this.user, store).then(() => { this.followRequestInProgress = false + + store.dispatch('stopFetching', 'friends') + store.commit('clearTimeline', { timeline: 'friends' }) + store.dispatch('startFetching', { timeline: 'friends' }) }) }, blockUser () { const store = this.$store store.state.api.backendInteractor.blockUser(this.user.id) - .then((blockedUser) => store.commit('addNewUsers', [blockedUser])) + .then((blockedUser) => { + store.commit('addNewUsers', [blockedUser]) + + store.dispatch('stopFetching', 'friends') + store.commit('clearTimeline', { timeline: 'friends' }) + store.dispatch('startFetching', { timeline: 'friends' }) + + store.commit('clearTimeline', { timeline: 'public' }) + store.commit('clearTimeline', { timeline: 'publicAndExternal' }) + }) }, unblockUser () { const store = this.$store store.state.api.backendInteractor.unblockUser(this.user.id) - .then((unblockedUser) => store.commit('addNewUsers', [unblockedUser])) + .then((unblockedUser) => { + store.commit('addNewUsers', [unblockedUser]) + + store.dispatch('stopFetching', 'friends') + store.commit('clearTimeline', { timeline: 'friends' }) + store.dispatch('startFetching', { timeline: 'friends' }) + + store.commit('clearTimeline', { timeline: 'public' }) + store.commit('clearTimeline', { timeline: 'publicAndExternal' }) + }) }, toggleMute () { const store = this.$store