diff options
| author | tusooa <tusooa@kazv.moe> | 2024-01-13 22:37:22 +0000 |
|---|---|---|
| committer | tusooa <tusooa@kazv.moe> | 2024-01-13 22:37:22 +0000 |
| commit | f5b4b5f7770dad5c8a90bce2263d3a97b9ad2d00 (patch) | |
| tree | 32e5961e4e05934af9323ffb78b0d9d908cbf9d9 | |
| parent | bdf46eca5ae73b0f12b755774cd901854c814522 (diff) | |
| parent | 6f452d672fe740035cf1d29d03bcda0d39438753 (diff) | |
Merge branch 'public-favorites' into 'develop'
Display public favorites on user profiles if enabled
See merge request pleroma/pleroma-fe!1883
| -rw-r--r-- | changelog.d/public-favorites.add | 1 | ||||
| -rw-r--r-- | src/components/user_profile/user_profile.js | 5 | ||||
| -rw-r--r-- | src/components/user_profile/user_profile.vue | 3 | ||||
| -rw-r--r-- | src/services/api/api.service.js | 6 | ||||
| -rw-r--r-- | src/services/entity_normalizer/entity_normalizer.service.js | 1 |
5 files changed, 15 insertions, 1 deletions
diff --git a/changelog.d/public-favorites.add b/changelog.d/public-favorites.add new file mode 100644 index 00000000..183fcc85 --- /dev/null +++ b/changelog.d/public-favorites.add @@ -0,0 +1 @@ +Display public favorites on user profiles
\ No newline at end of file diff --git a/src/components/user_profile/user_profile.js b/src/components/user_profile/user_profile.js index acb612ed..751bfd5a 100644 --- a/src/components/user_profile/user_profile.js +++ b/src/components/user_profile/user_profile.js @@ -80,6 +80,9 @@ const UserProfile = { followersTabVisible () { return this.isUs || !this.user.hide_followers }, + favoritesTabVisible () { + return this.isUs || !this.user.hide_favorites + }, formattedBirthday () { const browserLocale = localeService.internalToBrowserLocale(this.$i18n.locale) return this.user.birthday && new Date(Date.parse(this.user.birthday)).toLocaleDateString(browserLocale, { timeZone: 'UTC', day: 'numeric', month: 'long', year: 'numeric' }) @@ -103,6 +106,8 @@ const UserProfile = { startFetchingTimeline('user', userId) startFetchingTimeline('media', userId) if (this.isUs) { + startFetchingTimeline('favorites') + } else if (!this.user.hide_favorites) { startFetchingTimeline('favorites', userId) } // Fetch all pinned statuses immediately diff --git a/src/components/user_profile/user_profile.vue b/src/components/user_profile/user_profile.vue index c63a303c..d0618dbb 100644 --- a/src/components/user_profile/user_profile.vue +++ b/src/components/user_profile/user_profile.vue @@ -109,7 +109,7 @@ :footer-slipgate="footerRef" /> <Timeline - v-if="isUs" + v-if="favoritesTabVisible" key="favorites" :label="$t('user_card.favorites')" :disabled="!favorites.visibleStatuses.length" @@ -117,6 +117,7 @@ :title="$t('user_card.favorites')" timeline-name="favorites" :timeline="favorites" + :user-id="userId" :in-profile="true" :footer-slipgate="footerRef" /> diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js index bde2e163..19de07f7 100644 --- a/src/services/api/api.service.js +++ b/src/services/api/api.service.js @@ -108,6 +108,7 @@ 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_SCROBBLES_URL = id => `/api/v1/pleroma/accounts/${id}/scrobbles` +const PLEROMA_USER_FAVORITES_TIMELINE_URL = id => `/api/v1/pleroma/accounts/${id}/favourites` const PLEROMA_ADMIN_CONFIG_URL = '/api/pleroma/admin/config' const PLEROMA_ADMIN_DESCRIPTIONS_URL = '/api/pleroma/admin/config/descriptions' @@ -690,6 +691,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 } @@ -698,6 +700,10 @@ const fetchTimeline = ({ let url = timelineUrls[timeline] + if (timeline === 'favorites' && userId) { + url = timelineUrls.publicFavorites(userId) + } + if (timeline === 'user' || timeline === 'media') { url = url(userId) } diff --git a/src/services/entity_normalizer/entity_normalizer.service.js b/src/services/entity_normalizer/entity_normalizer.service.js index 85da5223..97b5beb5 100644 --- a/src/services/entity_normalizer/entity_normalizer.service.js +++ b/src/services/entity_normalizer/entity_normalizer.service.js @@ -107,6 +107,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 |
