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: [
|
props: [
|
||||||
'statusoid',
|
'statusoid',
|
||||||
'collapsable',
|
'collapsable',
|
||||||
'isPage'
|
'isPage',
|
||||||
|
'timelineName'
|
||||||
],
|
],
|
||||||
created () {
|
created () {
|
||||||
if (this.isPage) {
|
if (this.isPage) {
|
||||||
|
@ -120,8 +121,8 @@ const conversation = {
|
||||||
if (this.status) {
|
if (this.status) {
|
||||||
this.$store.state.api.backendInteractor.fetchConversation({id: this.status.id})
|
this.$store.state.api.backendInteractor.fetchConversation({id: this.status.id})
|
||||||
.then(({ancestors, descendants}) => {
|
.then(({ancestors, descendants}) => {
|
||||||
this.$store.dispatch('fetchFavoritedByUsers', { id: this.status.id })
|
this.$store.dispatch('fetchFavoritedByUsers', { id: this.statusId, retweetedStatusId: this.status.id, timelineName: this.timelineName })
|
||||||
this.$store.dispatch('fetchRebloggedByUsers', { id: this.status.id })
|
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: ancestors })
|
||||||
this.$store.dispatch('addNewStatuses', { statuses: descendants })
|
this.$store.dispatch('addNewStatuses', { statuses: descendants })
|
||||||
})
|
})
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
:key="status.id"
|
:key="status.id"
|
||||||
:statusoid="status"
|
:statusoid="status"
|
||||||
:collapsable="true"
|
:collapsable="true"
|
||||||
|
:timelineName="timelineName"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -460,19 +460,35 @@ export const mutations = {
|
||||||
queueFlush (state, { timeline, id }) {
|
queueFlush (state, { timeline, id }) {
|
||||||
state.timelines[timeline].flushMarker = 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] = {
|
||||||
...state.allStatusesObject[id],
|
...state.allStatusesObject[id],
|
||||||
favoritedBy: favoritedByUsers
|
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] = {
|
||||||
...state.allStatusesObject[id],
|
...state.allStatusesObject[id],
|
||||||
rebloggedBy: rebloggedByUsers
|
rebloggedBy: rebloggedByUsers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const statuses = {
|
const statuses = {
|
||||||
state: defaultState(),
|
state: defaultState(),
|
||||||
|
@ -537,11 +553,11 @@ const statuses = {
|
||||||
credentials: rootState.users.currentUser.credentials
|
credentials: rootState.users.currentUser.credentials
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
fetchFavoritedByUsers ({ rootState, commit }, { id }) {
|
fetchFavoritedByUsers ({ rootState, commit }, { id, retweetedStatusId, timelineName }) {
|
||||||
rootState.api.backendInteractor.fetchFavoritedByUsers({id}).then((favoritedByUsers) => commit('addFavoritedByUsers', { favoritedByUsers, id }))
|
rootState.api.backendInteractor.fetchFavoritedByUsers({id}).then((favoritedByUsers) => commit('addFavoritedByUsers', { favoritedByUsers, id: retweetedStatusId, timelineName }))
|
||||||
},
|
},
|
||||||
fetchRebloggedByUsers ({ rootState, commit }, { id }) {
|
fetchRebloggedByUsers ({ rootState, commit }, { id, retweetedStatusId, timelineName }) {
|
||||||
rootState.api.backendInteractor.fetchRebloggedByUsers({id}).then((rebloggedByUsers) => commit('addRebloggedByUsers', { rebloggedByUsers, id }))
|
rootState.api.backendInteractor.fetchRebloggedByUsers({id}).then((rebloggedByUsers) => commit('addRebloggedByUsers', { rebloggedByUsers, id: retweetedStatusId, timelineName }))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mutations
|
mutations
|
||||||
|
|
Loading…
Reference in a new issue