forked from AkkomaGang/akkoma-fe
display favs & reblogged users on expanded post in timeline view
This commit is contained in:
parent
efd20967df
commit
f74a6b4b57
3 changed files with 33 additions and 15 deletions
|
@ -41,7 +41,8 @@ const conversation = {
|
|||
props: [
|
||||
'statusoid',
|
||||
'collapsable',
|
||||
'isPage'
|
||||
'isPage',
|
||||
'timelineName'
|
||||
],
|
||||
created () {
|
||||
if (this.isPage) {
|
||||
|
@ -120,8 +121,8 @@ const conversation = {
|
|||
if (this.status) {
|
||||
this.$store.state.api.backendInteractor.fetchConversation({id: this.status.id})
|
||||
.then(({ancestors, descendants}) => {
|
||||
this.$store.dispatch('fetchFavoritedByUsers', { id: this.status.id })
|
||||
this.$store.dispatch('fetchRebloggedByUsers', { id: this.status.id })
|
||||
this.$store.dispatch('fetchFavoritedByUsers', { id: this.statusId, retweetedStatusId: this.status.id, timelineName: this.timelineName })
|
||||
this.$store.dispatch('fetchRebloggedByUsers', { id: this.statusId, retweetedStatusId: this.status.id, timelineName: this.timelineName })
|
||||
this.$store.dispatch('addNewStatuses', { statuses: ancestors })
|
||||
this.$store.dispatch('addNewStatuses', { statuses: descendants })
|
||||
})
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
:key="status.id"
|
||||
:statusoid="status"
|
||||
:collapsable="true"
|
||||
:timelineName="timelineName"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -460,19 +460,35 @@ export const mutations = {
|
|||
queueFlush (state, { timeline, id }) {
|
||||
state.timelines[timeline].flushMarker = id
|
||||
},
|
||||
addFavoritedByUsers (state, { favoritedByUsers, id }) {
|
||||
addFavoritedByUsers (state, { favoritedByUsers, id, timelineName }) {
|
||||
if (timelineName) {
|
||||
state.timelines[timelineName].visibleStatusesObject[id] = {
|
||||
...state.timelines[timelineName].visibleStatusesObject[id],
|
||||
favoritedBy: favoritedByUsers
|
||||
}
|
||||
state.timelines[timelineName].visibleStatuses = state.timelines[timelineName].visibleStatuses.map(visibleStatus => visibleStatus.id === id ? { ...visibleStatus, favoritedBy: favoritedByUsers } : visibleStatus)
|
||||
} else {
|
||||
state.allStatusesObject[id] = {
|
||||
...state.allStatusesObject[id],
|
||||
favoritedBy: favoritedByUsers
|
||||
}
|
||||
}
|
||||
},
|
||||
addRebloggedByUsers (state, { rebloggedByUsers, id }) {
|
||||
addRebloggedByUsers (state, { rebloggedByUsers, id, timelineName }) {
|
||||
if (timelineName) {
|
||||
state.timelines[timelineName].visibleStatusesObject[id] = {
|
||||
...state.timelines[timelineName].visibleStatusesObject[id],
|
||||
rebloggedBy: rebloggedByUsers
|
||||
}
|
||||
state.timelines[timelineName].visibleStatuses = state.timelines[timelineName].visibleStatuses.map(visibleStatus => visibleStatus.id === id ? { ...visibleStatus, rebloggedBy: rebloggedByUsers } : visibleStatus)
|
||||
} else {
|
||||
state.allStatusesObject[id] = {
|
||||
...state.allStatusesObject[id],
|
||||
rebloggedBy: rebloggedByUsers
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const statuses = {
|
||||
state: defaultState(),
|
||||
|
@ -537,11 +553,11 @@ const statuses = {
|
|||
credentials: rootState.users.currentUser.credentials
|
||||
})
|
||||
},
|
||||
fetchFavoritedByUsers ({ rootState, commit }, { id }) {
|
||||
rootState.api.backendInteractor.fetchFavoritedByUsers({id}).then((favoritedByUsers) => commit('addFavoritedByUsers', { favoritedByUsers, id }))
|
||||
fetchFavoritedByUsers ({ rootState, commit }, { id, retweetedStatusId, timelineName }) {
|
||||
rootState.api.backendInteractor.fetchFavoritedByUsers({id}).then((favoritedByUsers) => commit('addFavoritedByUsers', { favoritedByUsers, id: retweetedStatusId, timelineName }))
|
||||
},
|
||||
fetchRebloggedByUsers ({ rootState, commit }, { id }) {
|
||||
rootState.api.backendInteractor.fetchRebloggedByUsers({id}).then((rebloggedByUsers) => commit('addRebloggedByUsers', { rebloggedByUsers, id }))
|
||||
fetchRebloggedByUsers ({ rootState, commit }, { id, retweetedStatusId, timelineName }) {
|
||||
rootState.api.backendInteractor.fetchRebloggedByUsers({id}).then((rebloggedByUsers) => commit('addRebloggedByUsers', { rebloggedByUsers, id: retweetedStatusId, timelineName }))
|
||||
}
|
||||
},
|
||||
mutations
|
||||
|
|
Loading…
Reference in a new issue