Commit f1ff48ff authored by Dave LiPuma's avatar Dave LiPuma Committed by Tae Hoon

#468 - remove unpinned status from timeline

parent 2c89d49a
......@@ -365,11 +365,22 @@ const addNewNotifications = (state, { dispatch, notifications, older, visibleNot
})
}
const removeStatus = (state, { timeline, userId }) => {
const removeStatus = (state, { timeline, userId, statusId }) => {
const timelineObject = state.timelines[timeline]
let removed = false
if (userId) {
remove(timelineObject.statuses, { user: { id: userId } })
remove(timelineObject.visibleStatuses, { user: { id: userId } })
removed = true
} else if (statusId) {
remove(timelineObject.statuses, { id: statusId })
remove(timelineObject.visibleStatuses, { id: statusId })
removed = true
delete timelineObject.statusesObject[statusId]
delete timelineObject.visibleStatusesObject[statusId]
}
if (removed) {
timelineObject.minVisibleId = timelineObject.visibleStatuses.length > 0 ? last(timelineObject.visibleStatuses).id : 0
timelineObject.maxId = timelineObject.statuses.length > 0 ? first(timelineObject.statuses).id : 0
}
......@@ -540,6 +551,9 @@ const statuses = {
},
updatePinned ({ rootState, commit }, status) {
commit('setPinned', { status })
if (!status.pinned) {
commit('removeStatus', { timeline: 'pinned', statusId: status.id })
}
},
retweet ({ rootState, commit }, status) {
// Optimistic retweeting...
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment