Separated Posts & Replies (#145) (#148)
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

Co-authored-by: David <dmgf2008@hotmail.com>
Reviewed-on: AkkomaGang/pleroma-fe#148
Co-authored-by: Mergan <mergan@noreply.akkoma>
Co-committed-by: Mergan <mergan@noreply.akkoma>
This commit is contained in:
Mergan 2022-08-31 15:28:09 +00:00 committed by floatingghost
parent 7dc0464094
commit 48826ede36
5 changed files with 26 additions and 3 deletions

View file

@ -58,6 +58,9 @@ const UserProfile = {
timeline () { timeline () {
return this.$store.state.statuses.timelines.user return this.$store.state.statuses.timelines.user
}, },
replies () {
return this.$store.state.statuses.timelines.replies
},
favorites () { favorites () {
return this.$store.state.statuses.timelines.favorites return this.$store.state.statuses.timelines.favorites
}, },
@ -100,6 +103,7 @@ const UserProfile = {
const loadById = (userId) => { const loadById = (userId) => {
this.userId = userId this.userId = userId
startFetchingTimeline('user', userId) startFetchingTimeline('user', userId)
startFetchingTimeline('replies', userId)
startFetchingTimeline('media', userId) startFetchingTimeline('media', userId)
if (this.isUs) { if (this.isUs) {
startFetchingTimeline('favorites', userId) startFetchingTimeline('favorites', userId)
@ -137,6 +141,7 @@ const UserProfile = {
}, },
stopFetching () { stopFetching () {
this.$store.dispatch('stopFetchingTimeline', 'user') this.$store.dispatch('stopFetchingTimeline', 'user')
this.$store.dispatch('stopFetchingTimeline', 'replies')
this.$store.dispatch('stopFetchingTimeline', 'favorites') this.$store.dispatch('stopFetchingTimeline', 'favorites')
this.$store.dispatch('stopFetchingTimeline', 'media') this.$store.dispatch('stopFetchingTimeline', 'media')
}, },

View file

@ -79,6 +79,18 @@
:in-profile="true" :in-profile="true"
:footer-slipgate="footerRef" :footer-slipgate="footerRef"
/> />
<Timeline
key="replies"
:label="$t('user_card.replies')"
:count="user.statuses_count"
:embedded="true"
:title="$t('user_card.replies')"
:timeline="replies"
timeline-name="replies"
:user-id="userId"
:in-profile="true"
:footer-slipgate="footerRef"
/>
<div <div
v-if="followsTabVisible" v-if="followsTabVisible"
key="followees" key="followees"

View file

@ -1022,6 +1022,7 @@
"note": "Private note", "note": "Private note",
"per_day": "per day", "per_day": "per day",
"remote_follow": "Remote follow", "remote_follow": "Remote follow",
"replies": "With Replies",
"report": "Report", "report": "Report",
"show_repeats": "Show repeats", "show_repeats": "Show repeats",
"statuses": "Posts", "statuses": "Posts",

View file

@ -64,7 +64,8 @@ export const defaultState = () => ({
dms: emptyTl(), dms: emptyTl(),
bookmarks: emptyTl(), bookmarks: emptyTl(),
list: 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 // This makes sure that user timeline won't get data meant for other
// user. I.e. opening different user profiles makes request which could // user. I.e. opening different user profiles makes request which could
// return data late after user already viewing different user profile // 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 return
} }

View file

@ -617,6 +617,7 @@ const fetchTimeline = ({
notifications: MASTODON_USER_NOTIFICATIONS_URL, notifications: MASTODON_USER_NOTIFICATIONS_URL,
'publicAndExternal': MASTODON_PUBLIC_TIMELINE, 'publicAndExternal': MASTODON_PUBLIC_TIMELINE,
user: MASTODON_USER_TIMELINE_URL, user: MASTODON_USER_TIMELINE_URL,
replies: MASTODON_USER_TIMELINE_URL,
media: MASTODON_USER_TIMELINE_URL, media: MASTODON_USER_TIMELINE_URL,
list: MASTODON_LIST_TIMELINE_URL, list: MASTODON_LIST_TIMELINE_URL,
favorites: MASTODON_USER_FAVORITES_TIMELINE_URL, favorites: MASTODON_USER_FAVORITES_TIMELINE_URL,
@ -628,7 +629,7 @@ const fetchTimeline = ({
let url = timelineUrls[timeline] let url = timelineUrls[timeline]
if (timeline === 'user' || timeline === 'media') { if (timeline === 'user' || timeline === 'media' || timeline === 'replies') {
url = url(userId) url = url(userId)
} }
@ -660,6 +661,9 @@ const fetchTimeline = ({
if (replyVisibility !== 'all') { if (replyVisibility !== 'all') {
params.push(['reply_visibility', replyVisibility]) params.push(['reply_visibility', replyVisibility])
} }
if (timeline === 'user') {
params.push(['exclude_replies', 1])
}
params.push(['limit', 20]) params.push(['limit', 20])