kopia lustrzana https://github.com/nextcloud/social
Fix getting post from parents timeline
Signed-off-by: Louis Chemineau <louis@chmn.me>pull/1696/head
rodzic
609f704464
commit
ea7015ef4f
|
@ -184,8 +184,10 @@ const getters = {
|
|||
},
|
||||
getPostFromTimeline(state) {
|
||||
return (postId) => {
|
||||
if (typeof state.timeline[postId] !== 'undefined') {
|
||||
if (state.timeline[postId] !== undefined) {
|
||||
return state.timeline[postId]
|
||||
} else if (state.parentsTimeline[postId] !== undefined) {
|
||||
return state.parentsTimeline[postId]
|
||||
} else {
|
||||
logger.warn('Could not find post in timeline', { postId })
|
||||
}
|
||||
|
|
|
@ -63,29 +63,24 @@ export default {
|
|||
return this.$store.getters.getTimeline
|
||||
},
|
||||
},
|
||||
beforeMount() {
|
||||
// Get data of post clicked on
|
||||
async beforeMount() {
|
||||
this.mainPost = this.$store.getters.getPostFromTimeline(this.$route.params.id) || loadState('social', 'item')
|
||||
|
||||
// Fetch information of the related account
|
||||
this.$store.dispatch(this.serverData.public ? 'fetchPublicAccountInfo' : 'fetchAccountInfo', this.account).then((response) => {
|
||||
// We need to update this.uid because we may have asked info for an account whose domain part was a host-meta,
|
||||
// and the account returned by the backend always uses a non host-meta'ed domain for its ID
|
||||
this.uid = response.username
|
||||
})
|
||||
|
||||
// Fetch single post timeline
|
||||
const params = {
|
||||
account: this.account,
|
||||
id: this.$route.params.id,
|
||||
type: 'single-post',
|
||||
}
|
||||
this.$store.dispatch('changeTimelineType', {
|
||||
type: 'single-post',
|
||||
params,
|
||||
params: {
|
||||
account: this.account,
|
||||
id: this.$route.params.id,
|
||||
type: 'single-post',
|
||||
},
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
|
||||
// Fetch information of the related account
|
||||
const response = await this.$store.dispatch(this.serverData.public ? 'fetchPublicAccountInfo' : 'fetchAccountInfo', this.account)
|
||||
// We need to update this.uid because we may have asked info for an account whose domain part was a host-meta,
|
||||
// and the account returned by the backend always uses a non host-meta'ed domain for its ID
|
||||
this.uid = response.username
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
|
Ładowanie…
Reference in New Issue