Add Pinned toot update handler
This commit is contained in:
parent
07725445f9
commit
5fd2fdb6b0
|
@ -7,7 +7,7 @@
|
||||||
:focused="message.uri + message.id === focusedId"
|
:focused="message.uri + message.id === focusedId"
|
||||||
:pinned="true"
|
:pinned="true"
|
||||||
:overlaid="modalOpened"
|
:overlaid="modalOpened"
|
||||||
v-on:update="updateToot"
|
v-on:update="updatePinnedToot"
|
||||||
v-on:delete="deleteToot"
|
v-on:delete="deleteToot"
|
||||||
@focusNext="focusNext"
|
@focusNext="focusNext"
|
||||||
@focusPrev="focusPrev"
|
@focusPrev="focusPrev"
|
||||||
|
@ -118,6 +118,9 @@ export default {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
updatePinnedToot (message) {
|
||||||
|
this.$store.commit('TimelineSpace/Contents/SideBar/AccountProfile/Timeline/updatePinnedToot', message)
|
||||||
|
},
|
||||||
updateToot (message) {
|
updateToot (message) {
|
||||||
this.$store.commit('TimelineSpace/Contents/SideBar/AccountProfile/Timeline/updateToot', message)
|
this.$store.commit('TimelineSpace/Contents/SideBar/AccountProfile/Timeline/updateToot', message)
|
||||||
},
|
},
|
||||||
|
|
|
@ -20,6 +20,22 @@ const Timeline = {
|
||||||
changeLazyLoading (state, value) {
|
changeLazyLoading (state, value) {
|
||||||
state.lazyLoading = 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) {
|
updateToot (state, message) {
|
||||||
// Replace target message in timeline
|
// Replace target message in timeline
|
||||||
state.timeline = state.timeline.map((toot) => {
|
state.timeline = state.timeline.map((toot) => {
|
||||||
|
|
Loading…
Reference in New Issue