From 48826ede36cf00f131b3d6cd126bfbe4af76fbe1 Mon Sep 17 00:00:00 2001 From: Mergan Date: Wed, 31 Aug 2022 15:28:09 +0000 Subject: [PATCH] Separated Posts & Replies (#145) (#148) Co-authored-by: David Reviewed-on: https://akkoma.dev/AkkomaGang/pleroma-fe/pulls/148 Co-authored-by: Mergan Co-committed-by: Mergan --- src/components/user_profile/user_profile.js | 5 +++++ src/components/user_profile/user_profile.vue | 12 ++++++++++++ src/i18n/en.json | 1 + src/modules/statuses.js | 5 +++-- src/services/api/api.service.js | 6 +++++- 5 files changed, 26 insertions(+), 3 deletions(-) diff --git a/src/components/user_profile/user_profile.js b/src/components/user_profile/user_profile.js index b25a09d3..ed30c02e 100644 --- a/src/components/user_profile/user_profile.js +++ b/src/components/user_profile/user_profile.js @@ -58,6 +58,9 @@ const UserProfile = { timeline () { return this.$store.state.statuses.timelines.user }, + replies () { + return this.$store.state.statuses.timelines.replies + }, favorites () { return this.$store.state.statuses.timelines.favorites }, @@ -100,6 +103,7 @@ const UserProfile = { const loadById = (userId) => { this.userId = userId startFetchingTimeline('user', userId) + startFetchingTimeline('replies', userId) startFetchingTimeline('media', userId) if (this.isUs) { startFetchingTimeline('favorites', userId) @@ -137,6 +141,7 @@ const UserProfile = { }, stopFetching () { this.$store.dispatch('stopFetchingTimeline', 'user') + this.$store.dispatch('stopFetchingTimeline', 'replies') this.$store.dispatch('stopFetchingTimeline', 'favorites') this.$store.dispatch('stopFetchingTimeline', 'media') }, diff --git a/src/components/user_profile/user_profile.vue b/src/components/user_profile/user_profile.vue index f1ded418..760f104c 100644 --- a/src/components/user_profile/user_profile.vue +++ b/src/components/user_profile/user_profile.vue @@ -79,6 +79,18 @@ :in-profile="true" :footer-slipgate="footerRef" /> +
({ dms: emptyTl(), bookmarks: emptyTl(), list: emptyTl(), - bubble: emptyTl() + bubble: emptyTl(), + replies: emptyTl() } }) @@ -183,7 +184,7 @@ const addNewStatuses = (state, { statuses, showImmediately = false, timeline, us // This makes sure that user timeline won't get data meant for other // user. I.e. opening different user profiles makes request which could // return data late after user already viewing different user profile - if ((timeline === 'user' || timeline === 'media') && timelineObject.userId !== userId) { + if ((timeline === 'user' || timeline === 'media' || timeline === 'replies') && timelineObject.userId !== userId) { return } diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js index a5f71617..cb11a05f 100644 --- a/src/services/api/api.service.js +++ b/src/services/api/api.service.js @@ -617,6 +617,7 @@ const fetchTimeline = ({ notifications: MASTODON_USER_NOTIFICATIONS_URL, 'publicAndExternal': MASTODON_PUBLIC_TIMELINE, user: MASTODON_USER_TIMELINE_URL, + replies: MASTODON_USER_TIMELINE_URL, media: MASTODON_USER_TIMELINE_URL, list: MASTODON_LIST_TIMELINE_URL, favorites: MASTODON_USER_FAVORITES_TIMELINE_URL, @@ -628,7 +629,7 @@ const fetchTimeline = ({ let url = timelineUrls[timeline] - if (timeline === 'user' || timeline === 'media') { + if (timeline === 'user' || timeline === 'media' || timeline === 'replies') { url = url(userId) } @@ -660,6 +661,9 @@ const fetchTimeline = ({ if (replyVisibility !== 'all') { params.push(['reply_visibility', replyVisibility]) } + if (timeline === 'user') { + params.push(['exclude_replies', 1]) + } params.push(['limit', 20])