From 13b80b5c7c35147247047353037085c042d0dd3e Mon Sep 17 00:00:00 2001 From: taehoon Date: Fri, 30 Aug 2019 15:55:28 -0400 Subject: [PATCH 1/2] rename a mutation --- src/modules/users.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/modules/users.js b/src/modules/users.js index 4aebe04b..4d02f8d7 100644 --- a/src/modules/users.js +++ b/src/modules/users.js @@ -164,7 +164,7 @@ export const mutations = { state.currentUser.muteIds.push(muteId) } }, - setPinned (state, status) { + setPinnedToUser (state, status) { const user = state.usersObject[status.user.id] const index = user.pinnedStatusIds.indexOf(status.id) if (status.pinned && index === -1) { @@ -338,13 +338,13 @@ const users = { // Reconnect users to statuses store.commit('setUserForStatus', status) // Set pinned statuses to user - store.commit('setPinned', status) + store.commit('setPinnedToUser', status) }) each(compact(map(statuses, 'retweeted_status')), (status) => { // Reconnect users to retweets store.commit('setUserForStatus', status) // Set pinned retweets to user - store.commit('setPinned', status) + store.commit('setPinnedToUser', status) }) }, addNewNotifications (store, { notifications }) { From daf7d4e66179a844dd467f16a195ac5eada09ad1 Mon Sep 17 00:00:00 2001 From: taehoon Date: Fri, 30 Aug 2019 15:57:24 -0400 Subject: [PATCH 2/2] fix pin/unpin status logic --- src/modules/statuses.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/modules/statuses.js b/src/modules/statuses.js index e863d8a5..4356d0a7 100644 --- a/src/modules/statuses.js +++ b/src/modules/statuses.js @@ -426,10 +426,6 @@ export const mutations = { newStatus.favoritedBy.push(user) } }, - setPinned (state, status) { - const newStatus = state.allStatusesObject[status.id] - newStatus.pinned = status.pinned - }, setMuted (state, status) { const newStatus = state.allStatusesObject[status.id] newStatus.muted = status.muted @@ -560,13 +556,13 @@ const statuses = { rootState.api.backendInteractor.fetchPinnedStatuses(userId) .then(statuses => dispatch('addNewStatuses', { statuses, timeline: 'user', userId, showImmediately: true, noIdUpdate: true })) }, - pinStatus ({ rootState, commit }, statusId) { + pinStatus ({ rootState, dispatch }, statusId) { return rootState.api.backendInteractor.pinOwnStatus(statusId) - .then((status) => commit('setPinned', status)) + .then((status) => dispatch('addNewStatuses', { statuses: [status] })) }, - unpinStatus ({ rootState, commit }, statusId) { + unpinStatus ({ rootState, dispatch }, statusId) { rootState.api.backendInteractor.unpinOwnStatus(statusId) - .then((status) => commit('setPinned', status)) + .then((status) => dispatch('addNewStatuses', { statuses: [status] })) }, muteConversation ({ rootState, commit }, statusId) { return rootState.api.backendInteractor.muteConversation(statusId)