2019-09-15 10:51:13 +00:00
|
|
|
<template>
|
|
|
|
<div class="social__wrapper">
|
2019-10-07 13:57:33 +00:00
|
|
|
<profile-info v-if="accountLoaded && accountInfo" :uid="uid" />
|
2019-10-15 10:16:38 +00:00
|
|
|
<composer v-show="composerDisplayStatus" />
|
2019-10-25 12:12:24 +00:00
|
|
|
<timeline-entry class="main-post" :item="mainPost" />
|
2019-10-14 13:16:00 +00:00
|
|
|
<timeline-list v-if="timeline" :type="$route.params.type" />
|
2019-09-15 10:51:13 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
|
|
|
.social__timeline {
|
|
|
|
max-width: 600px;
|
|
|
|
margin: 15px auto;
|
|
|
|
}
|
|
|
|
|
|
|
|
#app-content {
|
|
|
|
position: relative;
|
|
|
|
}
|
|
|
|
|
|
|
|
</style>
|
|
|
|
|
|
|
|
<script>
|
2019-10-15 10:16:38 +00:00
|
|
|
import Composer from '../components/Composer.vue'
|
2019-10-07 13:57:33 +00:00
|
|
|
import ProfileInfo from '../components/ProfileInfo.vue'
|
|
|
|
import TimelineEntry from '../components/TimelineEntry.vue'
|
|
|
|
import TimelineList from '../components/TimelineList.vue'
|
2019-10-15 10:16:38 +00:00
|
|
|
import currentUserMixin from '../mixins/currentUserMixin'
|
2019-10-07 13:57:33 +00:00
|
|
|
import accountMixins from '../mixins/accountMixins'
|
|
|
|
import serverData from '../mixins/serverData'
|
2020-09-01 22:54:44 +00:00
|
|
|
import { loadState } from '@nextcloud/initial-state'
|
2019-09-15 10:51:13 +00:00
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'TimelineSinglePost',
|
|
|
|
components: {
|
2019-10-15 10:16:38 +00:00
|
|
|
Composer,
|
2019-10-07 13:57:33 +00:00
|
|
|
ProfileInfo,
|
2019-09-15 10:51:13 +00:00
|
|
|
TimelineEntry,
|
|
|
|
TimelineList
|
|
|
|
},
|
|
|
|
mixins: [
|
2019-10-07 13:57:33 +00:00
|
|
|
accountMixins,
|
2019-10-15 10:16:38 +00:00
|
|
|
currentUserMixin,
|
2019-10-07 13:57:33 +00:00
|
|
|
serverData
|
2019-09-15 10:51:13 +00:00
|
|
|
],
|
|
|
|
data() {
|
|
|
|
return {
|
2019-10-07 13:57:33 +00:00
|
|
|
mainPost: {},
|
2019-10-25 11:26:16 +00:00
|
|
|
uid: this.$route.params.account
|
2019-09-15 10:51:13 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
computed: {
|
2019-10-15 10:16:38 +00:00
|
|
|
/**
|
|
|
|
* @description Tells whether Composer shall be displayed or not
|
|
|
|
* @returns {boolean}
|
|
|
|
*/
|
|
|
|
composerDisplayStatus() {
|
|
|
|
return this.$store.getters.getComposerDisplayStatus
|
|
|
|
},
|
2019-10-14 13:16:00 +00:00
|
|
|
/**
|
2019-10-25 11:26:16 +00:00
|
|
|
* @description Extracts the viewed account name from the URL
|
2019-10-14 13:16:00 +00:00
|
|
|
* @returns {String}
|
|
|
|
*/
|
2019-10-07 13:57:33 +00:00
|
|
|
account() {
|
|
|
|
return window.location.href.split('/')[window.location.href.split('/').length - 2].substr(1)
|
2019-10-14 13:16:00 +00:00
|
|
|
},
|
|
|
|
/**
|
2019-10-25 11:26:16 +00:00
|
|
|
* @description Returns the timeline currently loaded in the store
|
2019-10-14 13:16:00 +00:00
|
|
|
* @returns {Object}
|
|
|
|
*/
|
|
|
|
timeline: function() {
|
|
|
|
return this.$store.getters.getTimeline
|
2019-10-07 13:57:33 +00:00
|
|
|
}
|
2019-09-15 10:51:13 +00:00
|
|
|
},
|
|
|
|
beforeMount: function() {
|
|
|
|
|
|
|
|
// Get data of post clicked on
|
2019-09-16 15:10:30 +00:00
|
|
|
if (typeof this.$route.params.id === 'undefined') {
|
2020-09-01 22:54:44 +00:00
|
|
|
this.mainPost = loadState('social', 'item')
|
2019-09-16 15:10:30 +00:00
|
|
|
} else {
|
|
|
|
this.mainPost = this.$store.getters.getPostFromTimeline(this.$route.params.id)
|
|
|
|
}
|
|
|
|
|
2019-10-07 13:57:33 +00:00
|
|
|
// 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.account
|
|
|
|
})
|
|
|
|
|
|
|
|
// Fetch single post timeline
|
2019-09-16 15:10:30 +00:00
|
|
|
let params = {
|
2019-10-07 13:57:33 +00:00
|
|
|
account: this.account,
|
2019-09-16 15:10:30 +00:00
|
|
|
id: window.location.href,
|
|
|
|
localId: window.location.href.split('/')[window.location.href.split('/').length - 1],
|
|
|
|
type: 'single-post'
|
|
|
|
}
|
2019-09-15 10:51:13 +00:00
|
|
|
this.$store.dispatch('changeTimelineType', {
|
2019-09-16 15:10:30 +00:00
|
|
|
type: 'single-post',
|
|
|
|
params: params
|
2019-09-15 10:51:13 +00:00
|
|
|
})
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
2019-10-25 12:12:24 +00:00
|
|
|
|
|
|
|
<style>
|
2020-10-12 14:54:13 +00:00
|
|
|
|
2019-10-25 12:12:24 +00:00
|
|
|
</style>
|