fix pin/unpin status logic

This commit is contained in:
taehoon 2019-08-30 15:57:24 -04:00
parent 13b80b5c7c
commit daf7d4e661

View file

@ -426,10 +426,6 @@ export const mutations = {
newStatus.favoritedBy.push(user) newStatus.favoritedBy.push(user)
} }
}, },
setPinned (state, status) {
const newStatus = state.allStatusesObject[status.id]
newStatus.pinned = status.pinned
},
setMuted (state, status) { setMuted (state, status) {
const newStatus = state.allStatusesObject[status.id] const newStatus = state.allStatusesObject[status.id]
newStatus.muted = status.muted newStatus.muted = status.muted
@ -560,13 +556,13 @@ const statuses = {
rootState.api.backendInteractor.fetchPinnedStatuses(userId) rootState.api.backendInteractor.fetchPinnedStatuses(userId)
.then(statuses => dispatch('addNewStatuses', { statuses, timeline: 'user', userId, showImmediately: true, noIdUpdate: true })) .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) 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) rootState.api.backendInteractor.unpinOwnStatus(statusId)
.then((status) => commit('setPinned', status)) .then((status) => dispatch('addNewStatuses', { statuses: [status] }))
}, },
muteConversation ({ rootState, commit }, statusId) { muteConversation ({ rootState, commit }, statusId) {
return rootState.api.backendInteractor.muteConversation(statusId) return rootState.api.backendInteractor.muteConversation(statusId)