From 0579eb337e318a65261b1e6063fdc35c63f8183c Mon Sep 17 00:00:00 2001 From: AkiraFukushima Date: Sun, 15 Sep 2019 22:34:27 +0900 Subject: [PATCH 1/5] refs #1035 Re-fetch relationship after mute/block/follow action in sidebar --- .../Contents/SideBar/AccountProfile.ts | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/renderer/store/TimelineSpace/Contents/SideBar/AccountProfile.ts b/src/renderer/store/TimelineSpace/Contents/SideBar/AccountProfile.ts index 6836e526..3d2f0212 100644 --- a/src/renderer/store/TimelineSpace/Contents/SideBar/AccountProfile.ts +++ b/src/renderer/store/TimelineSpace/Contents/SideBar/AccountProfile.ts @@ -74,37 +74,42 @@ const actions: ActionTree = { commit(MUTATION_TYPES.CHANGE_RELATIONSHIP, res.data[0]) return res.data }, - follow: async ({ commit, rootState }, account: Account) => { + follow: async ({ commit, rootState, dispatch }, account: Account) => { const client = new Mastodon(rootState.TimelineSpace.account.accessToken!, rootState.TimelineSpace.account.baseURL + '/api/v1') const res: Response = await client.post(`/accounts/${account.id}/follow`) commit(MUTATION_TYPES.CHANGE_RELATIONSHIP, res.data) + dispatch('fetchRelationship', account) return res.data }, - unfollow: async ({ commit, rootState }, account: Account) => { + unfollow: async ({ commit, rootState, dispatch }, account: Account) => { const client = new Mastodon(rootState.TimelineSpace.account.accessToken!, rootState.TimelineSpace.account.baseURL + '/api/v1') const res: Response = await client.post(`/accounts/${account.id}/unfollow`) commit(MUTATION_TYPES.CHANGE_RELATIONSHIP, res.data) + dispatch('fetchRelationship', account) return res.data }, close: ({ commit }) => { commit(MUTATION_TYPES.CHANGE_ACCOUNT, null) }, - unmute: async ({ rootState, commit }, account: Account) => { + unmute: async ({ rootState, commit, dispatch }, account: Account) => { const client = new Mastodon(rootState.TimelineSpace.account.accessToken!, rootState.TimelineSpace.account.baseURL + '/api/v1') const res: Response = await client.post(`/accounts/${account.id}/unmute`) commit(MUTATION_TYPES.CHANGE_RELATIONSHIP, res.data) + dispatch('fetchRelationship', account) return res.data }, - block: async ({ rootState, commit }, account: Account) => { + block: async ({ rootState, commit, dispatch }, account: Account) => { const client = new Mastodon(rootState.TimelineSpace.account.accessToken!, rootState.TimelineSpace.account.baseURL + '/api/v1') const res: Response = await client.post(`/accounts/${account.id}/block`) commit(MUTATION_TYPES.CHANGE_RELATIONSHIP, res.data) + dispatch('fetchRelationship', account) return res.data }, - unblock: async ({ rootState, commit }, account: Account) => { + unblock: async ({ rootState, commit, dispatch }, account: Account) => { const client = new Mastodon(rootState.TimelineSpace.account.accessToken!, rootState.TimelineSpace.account.baseURL + '/api/v1') const res: Response = await client.post(`/accounts/${account.id}/unblock`) commit(MUTATION_TYPES.CHANGE_RELATIONSHIP, res.data) + dispatch('fetchRelationship', account) return res.data } } From ed432b56d31292ff9146c72303bb9311174d7627 Mon Sep 17 00:00:00 2001 From: AkiraFukushima Date: Sun, 15 Sep 2019 22:41:46 +0900 Subject: [PATCH 2/5] refs #1035 Add refresh button for sidebar --- .../TimelineSpace/Contents/SideBar.vue | 63 +++++++++++-------- 1 file changed, 36 insertions(+), 27 deletions(-) diff --git a/src/renderer/components/TimelineSpace/Contents/SideBar.vue b/src/renderer/components/TimelineSpace/Contents/SideBar.vue index c7e52b26..3a98bb63 100644 --- a/src/renderer/components/TimelineSpace/Contents/SideBar.vue +++ b/src/renderer/components/TimelineSpace/Contents/SideBar.vue @@ -1,24 +1,25 @@