From 4d91a7b2c36b3aff82d8988196ec1703709b93f8 Mon Sep 17 00:00:00 2001 From: Lamp Date: Mon, 6 May 2024 17:55:10 -0700 Subject: [PATCH] Fix public favorites MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Show favorites tab to anyone when "Don't show list of my favorites" is unchecked. Adapted from upstream changes by marcin mikołajczak : https://git.pleroma.social/pleroma/pleroma-fe/-/commit/6f452d672fe740035cf1d29d03bcda0d39438753?merge_request_iid=1883 https://git.pleroma.social/pleroma/pleroma-fe/-/commit/1ceffb4e713b4b20d70121fba92d2b50f2d3cadf?merge_request_iid=1908 --- src/components/user_profile/user_profile.js | 9 ++++++--- src/components/user_profile/user_profile.vue | 4 ++-- src/services/api/api.service.js | 6 ++++++ .../entity_normalizer/entity_normalizer.service.js | 1 + 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/components/user_profile/user_profile.js b/src/components/user_profile/user_profile.js index eaadca72..a45a63b5 100644 --- a/src/components/user_profile/user_profile.js +++ b/src/components/user_profile/user_profile.js @@ -97,6 +97,9 @@ const UserProfile = { followersTabVisible () { return this.isUs || !this.user.hide_followers }, + favoritesTabVisible () { + return this.isUs || !this.user.hide_favorites + }, currentUser () { return this.$store.state.users.currentUser }, @@ -114,14 +117,14 @@ const UserProfile = { replies: 'replies', media: 'media' } - // only we can see our own favourites - if (this.isUs) timelineTabMap['favorites'] = 'favorites' + + if (this.favoritesTabVisible) timelineTabMap['favorites'] = 'favorites' const timeline = timelineTabMap[nextTab] if (timeline) { this.stopFetching() - this.$store.dispatch('startFetchingTimeline', { timeline: timeline, userId: this.userId }) + this.$store.dispatch('startFetchingTimeline', { timeline: timeline, userId: nextTab == 'favorites' && this.isUs ? null : this.userId }) } }, load (userNameOrId) { diff --git a/src/components/user_profile/user_profile.vue b/src/components/user_profile/user_profile.vue index 5465778a..92c7c920 100644 --- a/src/components/user_profile/user_profile.vue +++ b/src/components/user_profile/user_profile.vue @@ -165,14 +165,14 @@ :footer-slipgate="footerRef" /> diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js index de21ef3b..379c65d6 100644 --- a/src/services/api/api.service.js +++ b/src/services/api/api.service.js @@ -107,6 +107,7 @@ const PLEROMA_ANNOUNCEMENTS_URL = '/api/v1/pleroma/admin/announcements' const PLEROMA_POST_ANNOUNCEMENT_URL = '/api/v1/pleroma/admin/announcements' const PLEROMA_EDIT_ANNOUNCEMENT_URL = id => `/api/v1/pleroma/admin/announcements/${id}` const PLEROMA_DELETE_ANNOUNCEMENT_URL = id => `/api/v1/pleroma/admin/announcements/${id}` +const PLEROMA_USER_FAVORITES_TIMELINE_URL = id => `/api/v1/pleroma/accounts/${id}/favourites` const AKKOMA_SETTING_PROFILE_URL = (name) => `/api/v1/akkoma/frontend_settings/pleroma-fe/${name}` const AKKOMA_SETTING_PROFILE_LIST = `/api/v1/akkoma/frontend_settings/pleroma-fe` const MASTODON_TAG_URL = (name) => `/api/v1/tags/${name}` @@ -709,6 +710,7 @@ const fetchTimeline = ({ media: MASTODON_USER_TIMELINE_URL, list: MASTODON_LIST_TIMELINE_URL, favorites: MASTODON_USER_FAVORITES_TIMELINE_URL, + publicFavorites: PLEROMA_USER_FAVORITES_TIMELINE_URL, tag: MASTODON_TAG_TIMELINE_URL, bookmarks: MASTODON_BOOKMARK_TIMELINE_URL } @@ -717,6 +719,10 @@ const fetchTimeline = ({ let url = timelineUrls[timeline] + if (timeline === 'favorites' && userId) { + url = timelineUrls.publicFavorites(userId) + } + if (timeline === 'user' || timeline === 'media' || timeline === 'replies') { url = url(userId) } diff --git a/src/services/entity_normalizer/entity_normalizer.service.js b/src/services/entity_normalizer/entity_normalizer.service.js index b7f382d8..85a35bdd 100644 --- a/src/services/entity_normalizer/entity_normalizer.service.js +++ b/src/services/entity_normalizer/entity_normalizer.service.js @@ -110,6 +110,7 @@ export const parseUser = (data) => { output.allow_following_move = data.pleroma.allow_following_move + output.hide_favorites = data.pleroma.hide_favorites output.hide_follows = data.pleroma.hide_follows output.hide_followers = data.pleroma.hide_followers output.hide_follows_count = data.pleroma.hide_follows_count -- 2.43.0