social/src/views/TimelineSinglePost.vue

105 wiersze
2.6 KiB
Vue
Czysty Zwykły widok Historia

<template>
<div class="social__wrapper">
<ProfileInfo v-if="accountLoaded && accountInfo" :uid="uid" />
<Composer v-show="composerDisplayStatus" />
Use new Mastodon like API Revert "Revert "Merge pull request #1581 from nextcloud/artonge/feat/use_new_api"" This reverts commit c4eef0b2d476ffcf10cfc3a44ea426d3ec7587b4. Signed-off-by: Louis Chemineau <louis@chmn.me> Adapt views to new timeline api Signed-off-by: Louis Chemineau <louis@chmn.me> Add types Signed-off-by: Louis Chemineau <louis@chmn.me> Fix type errors Signed-off-by: Louis Chemineau <louis@chmn.me> Adapte front-end to mastodon data format + Add typing + Modernize code Signed-off-by: Louis Chemineau <louis@chmn.me> Use new API for media attachments + Split Composer.vue into tinier composent + Use blurhash value of attachments Signed-off-by: Louis Chemineau <louis@chmn.me> Fix media attachment rendering in post component Signed-off-by: Louis Chemineau <louis@chmn.me> Use square container to display statuses attachments Signed-off-by: Louis Chemineau <louis@chmn.me> Add typing to timeline.js And fix type errors Signed-off-by: Louis Chemineau <louis@chmn.me> Forward format to getStreamSelectSql for direct timeline Signed-off-by: Louis Chemineau <louis@chmn.me> Fix liked timeline Signed-off-by: Louis Chemineau <louis@chmn.me> Use new API for local and federated timelines Signed-off-by: Louis Chemineau <louis@chmn.me> Fix profile and avatar for local users Signed-off-by: Louis Chemineau <louis@chmn.me> Update babel config Signed-off-by: Louis Chemineau <louis@chmn.me> Improve typing in account.js Signed-off-by: Louis Chemineau <louis@chmn.me> Handle new notification format Signed-off-by: Louis Chemineau <louis@chmn.me> Fix follow button Signed-off-by: Louis Chemineau <louis@chmn.me> Fix condition of delete button for statuses Signed-off-by: Louis Chemineau <louis@chmn.me> Add relationship fetching Signed-off-by: Louis Chemineau <louis@chmn.me> Improve attachments viewer Signed-off-by: Louis Chemineau <louis@chmn.me> Correctly use twemoji Signed-off-by: Louis Chemineau <louis@chmn.me> Clean up composer Signed-off-by: Louis Chemineau <louis@chmn.me> Insert emoji on the last line instead of creating a new one Signed-off-by: Louis Chemineau <louis@chmn.me> Overall improvements in composer Signed-off-by: Louis Chemineau <louis@chmn.me> Clean up PreviewGridItem Signed-off-by: Louis Chemineau <louis@chmn.me> Fix fetching relationships Signed-off-by: Louis Chemineau <louis@chmn.me> Fix followers and following list Signed-off-by: Louis Chemineau <louis@chmn.me> Fix direct link to followers and following lists Signed-off-by: Louis Chemineau <louis@chmn.me> Fix notifications endpoint Signed-off-by: Louis Chemineau <louis@chmn.me> Handle different types of notifications Signed-off-by: Louis Chemineau <louis@chmn.me> Add formatted date as title for statuses Signed-off-by: Louis Chemineau <louis@chmn.me> Fix entryContent computed property Signed-off-by: Louis Chemineau <louis@chmn.me> Handle reblog Signed-off-by: Louis Chemineau <louis@chmn.me> Fix favourite type Signed-off-by: Louis Chemineau <louis@chmn.me> Load context of status for single post Signed-off-by: Louis Chemineau <louis@chmn.me> Use new format to set the uid in single post Signed-off-by: Louis Chemineau <louis@chmn.me> Fix display name property Signed-off-by: Louis Chemineau <louis@chmn.me> Hack to handle context of single post Signed-off-by: Louis Chemineau <louis@chmn.me> Use item id to fetch context Signed-off-by: Louis Chemineau <louis@chmn.me> Remove unsused variable Signed-off-by: Louis Chemineau <louis@chmn.me>
2023-01-19 16:18:11 +00:00
<TimelineEntry class="main-post" :item="mainPost" type="single-post" />
<TimelineList v-if="timeline" :type="$route.params.type" />
</div>
</template>
<script>
import Composer from '../components/Composer/Composer.vue'
import ProfileInfo from '../components/ProfileInfo.vue'
import TimelineEntry from '../components/TimelineEntry.vue'
import TimelineList from '../components/TimelineList.vue'
import currentUserMixin from '../mixins/currentUserMixin.js'
import accountMixins from '../mixins/accountMixins.js'
import serverData from '../mixins/serverData.js'
import { loadState } from '@nextcloud/initial-state'
export default {
name: 'TimelineSinglePost',
components: {
Composer,
ProfileInfo,
TimelineEntry,
TimelineList,
},
mixins: [
accountMixins,
currentUserMixin,
serverData,
],
data() {
return {
mainPost: {},
uid: this.$route.params.account,
}
},
computed: {
/**
* @description Tells whether Composer shall be displayed or not
* @return {boolean}
*/
composerDisplayStatus() {
return this.$store.getters.getComposerDisplayStatus
},
/**
* @description Extracts the viewed account name from the URL
* @return {string}
*/
account() {
return window.location.href.split('/')[window.location.href.split('/').length - 2].slice(1)
},
/**
* @description Returns the timeline currently loaded in the store
* @return {object}
*/
timeline() {
return this.$store.getters.getTimeline
},
},
beforeMount() {
// Get data of post clicked on
if (typeof this.$route.params.id === 'undefined') {
this.mainPost = loadState('social', 'item')
} else {
this.mainPost = this.$store.getters.getPostFromTimeline(this.$route.params.id)
}
// 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
Use new Mastodon like API Revert "Revert "Merge pull request #1581 from nextcloud/artonge/feat/use_new_api"" This reverts commit c4eef0b2d476ffcf10cfc3a44ea426d3ec7587b4. Signed-off-by: Louis Chemineau <louis@chmn.me> Adapt views to new timeline api Signed-off-by: Louis Chemineau <louis@chmn.me> Add types Signed-off-by: Louis Chemineau <louis@chmn.me> Fix type errors Signed-off-by: Louis Chemineau <louis@chmn.me> Adapte front-end to mastodon data format + Add typing + Modernize code Signed-off-by: Louis Chemineau <louis@chmn.me> Use new API for media attachments + Split Composer.vue into tinier composent + Use blurhash value of attachments Signed-off-by: Louis Chemineau <louis@chmn.me> Fix media attachment rendering in post component Signed-off-by: Louis Chemineau <louis@chmn.me> Use square container to display statuses attachments Signed-off-by: Louis Chemineau <louis@chmn.me> Add typing to timeline.js And fix type errors Signed-off-by: Louis Chemineau <louis@chmn.me> Forward format to getStreamSelectSql for direct timeline Signed-off-by: Louis Chemineau <louis@chmn.me> Fix liked timeline Signed-off-by: Louis Chemineau <louis@chmn.me> Use new API for local and federated timelines Signed-off-by: Louis Chemineau <louis@chmn.me> Fix profile and avatar for local users Signed-off-by: Louis Chemineau <louis@chmn.me> Update babel config Signed-off-by: Louis Chemineau <louis@chmn.me> Improve typing in account.js Signed-off-by: Louis Chemineau <louis@chmn.me> Handle new notification format Signed-off-by: Louis Chemineau <louis@chmn.me> Fix follow button Signed-off-by: Louis Chemineau <louis@chmn.me> Fix condition of delete button for statuses Signed-off-by: Louis Chemineau <louis@chmn.me> Add relationship fetching Signed-off-by: Louis Chemineau <louis@chmn.me> Improve attachments viewer Signed-off-by: Louis Chemineau <louis@chmn.me> Correctly use twemoji Signed-off-by: Louis Chemineau <louis@chmn.me> Clean up composer Signed-off-by: Louis Chemineau <louis@chmn.me> Insert emoji on the last line instead of creating a new one Signed-off-by: Louis Chemineau <louis@chmn.me> Overall improvements in composer Signed-off-by: Louis Chemineau <louis@chmn.me> Clean up PreviewGridItem Signed-off-by: Louis Chemineau <louis@chmn.me> Fix fetching relationships Signed-off-by: Louis Chemineau <louis@chmn.me> Fix followers and following list Signed-off-by: Louis Chemineau <louis@chmn.me> Fix direct link to followers and following lists Signed-off-by: Louis Chemineau <louis@chmn.me> Fix notifications endpoint Signed-off-by: Louis Chemineau <louis@chmn.me> Handle different types of notifications Signed-off-by: Louis Chemineau <louis@chmn.me> Add formatted date as title for statuses Signed-off-by: Louis Chemineau <louis@chmn.me> Fix entryContent computed property Signed-off-by: Louis Chemineau <louis@chmn.me> Handle reblog Signed-off-by: Louis Chemineau <louis@chmn.me> Fix favourite type Signed-off-by: Louis Chemineau <louis@chmn.me> Load context of status for single post Signed-off-by: Louis Chemineau <louis@chmn.me> Use new format to set the uid in single post Signed-off-by: Louis Chemineau <louis@chmn.me> Fix display name property Signed-off-by: Louis Chemineau <louis@chmn.me> Hack to handle context of single post Signed-off-by: Louis Chemineau <louis@chmn.me> Use item id to fetch context Signed-off-by: Louis Chemineau <louis@chmn.me> Remove unsused variable Signed-off-by: Louis Chemineau <louis@chmn.me>
2023-01-19 16:18:11 +00:00
this.uid = response.username
})
// Fetch single post timeline
const params = {
account: this.account,
id: window.location.href,
Use new Mastodon like API Revert "Revert "Merge pull request #1581 from nextcloud/artonge/feat/use_new_api"" This reverts commit c4eef0b2d476ffcf10cfc3a44ea426d3ec7587b4. Signed-off-by: Louis Chemineau <louis@chmn.me> Adapt views to new timeline api Signed-off-by: Louis Chemineau <louis@chmn.me> Add types Signed-off-by: Louis Chemineau <louis@chmn.me> Fix type errors Signed-off-by: Louis Chemineau <louis@chmn.me> Adapte front-end to mastodon data format + Add typing + Modernize code Signed-off-by: Louis Chemineau <louis@chmn.me> Use new API for media attachments + Split Composer.vue into tinier composent + Use blurhash value of attachments Signed-off-by: Louis Chemineau <louis@chmn.me> Fix media attachment rendering in post component Signed-off-by: Louis Chemineau <louis@chmn.me> Use square container to display statuses attachments Signed-off-by: Louis Chemineau <louis@chmn.me> Add typing to timeline.js And fix type errors Signed-off-by: Louis Chemineau <louis@chmn.me> Forward format to getStreamSelectSql for direct timeline Signed-off-by: Louis Chemineau <louis@chmn.me> Fix liked timeline Signed-off-by: Louis Chemineau <louis@chmn.me> Use new API for local and federated timelines Signed-off-by: Louis Chemineau <louis@chmn.me> Fix profile and avatar for local users Signed-off-by: Louis Chemineau <louis@chmn.me> Update babel config Signed-off-by: Louis Chemineau <louis@chmn.me> Improve typing in account.js Signed-off-by: Louis Chemineau <louis@chmn.me> Handle new notification format Signed-off-by: Louis Chemineau <louis@chmn.me> Fix follow button Signed-off-by: Louis Chemineau <louis@chmn.me> Fix condition of delete button for statuses Signed-off-by: Louis Chemineau <louis@chmn.me> Add relationship fetching Signed-off-by: Louis Chemineau <louis@chmn.me> Improve attachments viewer Signed-off-by: Louis Chemineau <louis@chmn.me> Correctly use twemoji Signed-off-by: Louis Chemineau <louis@chmn.me> Clean up composer Signed-off-by: Louis Chemineau <louis@chmn.me> Insert emoji on the last line instead of creating a new one Signed-off-by: Louis Chemineau <louis@chmn.me> Overall improvements in composer Signed-off-by: Louis Chemineau <louis@chmn.me> Clean up PreviewGridItem Signed-off-by: Louis Chemineau <louis@chmn.me> Fix fetching relationships Signed-off-by: Louis Chemineau <louis@chmn.me> Fix followers and following list Signed-off-by: Louis Chemineau <louis@chmn.me> Fix direct link to followers and following lists Signed-off-by: Louis Chemineau <louis@chmn.me> Fix notifications endpoint Signed-off-by: Louis Chemineau <louis@chmn.me> Handle different types of notifications Signed-off-by: Louis Chemineau <louis@chmn.me> Add formatted date as title for statuses Signed-off-by: Louis Chemineau <louis@chmn.me> Fix entryContent computed property Signed-off-by: Louis Chemineau <louis@chmn.me> Handle reblog Signed-off-by: Louis Chemineau <louis@chmn.me> Fix favourite type Signed-off-by: Louis Chemineau <louis@chmn.me> Load context of status for single post Signed-off-by: Louis Chemineau <louis@chmn.me> Use new format to set the uid in single post Signed-off-by: Louis Chemineau <louis@chmn.me> Fix display name property Signed-off-by: Louis Chemineau <louis@chmn.me> Hack to handle context of single post Signed-off-by: Louis Chemineau <louis@chmn.me> Use item id to fetch context Signed-off-by: Louis Chemineau <louis@chmn.me> Remove unsused variable Signed-off-by: Louis Chemineau <louis@chmn.me>
2023-01-19 16:18:11 +00:00
localId: this.mainPost.id,
type: 'single-post',
}
this.$store.dispatch('changeTimelineType', {
type: 'single-post',
params,
})
},
methods: {
},
}
</script>
<style scoped>
.social__timeline {
max-width: 600px;
margin: 15px auto;
}
#app-content {
position: relative;
}
</style>