mirror of
https://github.com/h3poteto/whalebird-desktop
synced 2025-02-07 12:53:57 +01:00
Add Pinned toot update handler
This commit is contained in:
parent
07725445f9
commit
5fd2fdb6b0
@ -7,7 +7,7 @@
|
||||
:focused="message.uri + message.id === focusedId"
|
||||
:pinned="true"
|
||||
:overlaid="modalOpened"
|
||||
v-on:update="updateToot"
|
||||
v-on:update="updatePinnedToot"
|
||||
v-on:delete="deleteToot"
|
||||
@focusNext="focusNext"
|
||||
@focusPrev="focusPrev"
|
||||
@ -118,6 +118,9 @@ export default {
|
||||
})
|
||||
}
|
||||
},
|
||||
updatePinnedToot (message) {
|
||||
this.$store.commit('TimelineSpace/Contents/SideBar/AccountProfile/Timeline/updatePinnedToot', message)
|
||||
},
|
||||
updateToot (message) {
|
||||
this.$store.commit('TimelineSpace/Contents/SideBar/AccountProfile/Timeline/updateToot', message)
|
||||
},
|
||||
|
@ -20,6 +20,22 @@ const Timeline = {
|
||||
changeLazyLoading (state, value) {
|
||||
state.lazyLoading = value
|
||||
},
|
||||
updatePinnedToot (state, message) {
|
||||
state.pinnedToots = state.pinnedToots.map((toot) => {
|
||||
if (toot.id === message.id) {
|
||||
return message
|
||||
} else if (toot.reblog !== null && toot.reblog.id === message.id) {
|
||||
// When user reblog/favourite a reblogged toot, target message is a original toot.
|
||||
// So, a message which is received now is original toot.
|
||||
const reblog = {
|
||||
reblog: message
|
||||
}
|
||||
return Object.assign(toot, reblog)
|
||||
} else {
|
||||
return toot
|
||||
}
|
||||
})
|
||||
},
|
||||
updateToot (state, message) {
|
||||
// Replace target message in timeline
|
||||
state.timeline = state.timeline.map((toot) => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user