mirror of
https://github.com/h3poteto/whalebird-desktop
synced 2025-01-27 07:46:15 +01:00
Merge pull request #64 from h3poteto/iss-62
refs #62 Update favourited status in homeTimeline and notifications
This commit is contained in:
commit
aac92ab4ef
@ -47,6 +47,27 @@ const TimelineSpace = {
|
||||
},
|
||||
changeNewTootModal (state, modal) {
|
||||
state.newTootModal = modal
|
||||
},
|
||||
updateToot (state, message) {
|
||||
// Replace target message in homeTimeline and notifications
|
||||
state.homeTimeline = state.homeTimeline.map((toot) => {
|
||||
if (toot.id === message.id) {
|
||||
return message
|
||||
} else {
|
||||
return toot
|
||||
}
|
||||
})
|
||||
|
||||
state.notifications = state.notifications.map((notification) => {
|
||||
if (notification.type === 'mention' && notification.status.id === message.id) {
|
||||
const status = {
|
||||
status: message
|
||||
}
|
||||
return Object.assign(notification, status)
|
||||
} else {
|
||||
return notification
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
|
@ -15,7 +15,7 @@ const Toot = {
|
||||
)
|
||||
client.post(`/statuses/${message.id}/favourite`, {}, (err, data, res) => {
|
||||
if (err) return reject(err)
|
||||
// TODO: update toot data
|
||||
commit('TimelineSpace/updateToot', data, { root: true })
|
||||
resolve(res)
|
||||
})
|
||||
})
|
||||
@ -30,7 +30,7 @@ const Toot = {
|
||||
)
|
||||
client.post(`/statuses/${message.id}/unfavourite`, {}, (err, data, res) => {
|
||||
if (err) return reject(err)
|
||||
// TODO: update toot data
|
||||
commit('TimelineSpace/updateToot', data, { root: true })
|
||||
resolve(res)
|
||||
})
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user