From 6f452d672fe740035cf1d29d03bcda0d39438753 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marcin=20miko=C5=82ajczak?= Date: Thu, 28 Dec 2023 10:43:06 +0100 Subject: [PATCH 1/4] Display public favorites on user profiles MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- changelog.d/public-favorites.add | 1 + src/components/user_profile/user_profile.js | 5 +++++ src/components/user_profile/user_profile.vue | 3 ++- src/services/api/api.service.js | 6 ++++++ src/services/entity_normalizer/entity_normalizer.service.js | 1 + 5 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 changelog.d/public-favorites.add 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" /> 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 From 9ec61c07ef2e4fe96b88590e7d29273f3266823d Mon Sep 17 00:00:00 2001 From: tusooa Date: Sun, 31 Dec 2023 21:23:07 +0000 Subject: [PATCH 2/4] Translated using Weblate (Chinese (Simplified)) Currently translated at 98.3% (1068 of 1086 strings) Translation: Pleroma/Pleroma-FE Translate-URL: https://translate.pleroma.social/projects/pleroma/pleroma-fe/zh_Hans/ --- src/i18n/zh.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/i18n/zh.json b/src/i18n/zh.json index 396cb2f2..2ade41f7 100644 --- a/src/i18n/zh.json +++ b/src/i18n/zh.json @@ -943,7 +943,7 @@ "sandbox": "强制帖子为只有关注者可看", "disable_remote_subscription": "禁止从远程实例关注用户", "disable_any_subscription": "完全禁止关注用户", - "quarantine": "从联合实例中禁止用户帖子", + "quarantine": "不许帖子传入别站", "delete_user": "删除用户", "delete_user_data_and_deactivate_confirmation": "这将永久删除该账户的数据并停用该账户。你完全确定吗?" }, From 82c00449638a7aa06b63454f6dc5a44924a6d36e Mon Sep 17 00:00:00 2001 From: tusooa Date: Tue, 25 Jul 2023 10:46:27 -0400 Subject: [PATCH 3/4] Show a dedicated registration notice page when further action is required after registering --- changelog.d/registration-notice.add | 1 + src/components/registration/registration.js | 10 ++++++++-- src/components/registration/registration.vue | 14 ++++++++++++- src/modules/users.js | 21 +++++++++++++++++--- 4 files changed, 40 insertions(+), 6 deletions(-) create mode 100644 changelog.d/registration-notice.add diff --git a/changelog.d/registration-notice.add b/changelog.d/registration-notice.add new file mode 100644 index 00000000..b2777ba2 --- /dev/null +++ b/changelog.d/registration-notice.add @@ -0,0 +1 @@ +Show a dedicated registration notice page when further action is required after registering diff --git a/src/components/registration/registration.js b/src/components/registration/registration.js index b88bdeec..ca1fed94 100644 --- a/src/components/registration/registration.js +++ b/src/components/registration/registration.js @@ -83,6 +83,8 @@ const registration = { signedIn: (state) => !!state.users.currentUser, isPending: (state) => state.users.signUpPending, serverValidationErrors: (state) => state.users.signUpErrors, + signUpNotice: (state) => state.users.signUpNotice, + hasSignUpNotice: (state) => !!state.users.signUpNotice.message, termsOfService: (state) => state.instance.tos, accountActivationRequired: (state) => state.instance.accountActivationRequired, accountApprovalRequired: (state) => state.instance.accountApprovalRequired, @@ -107,8 +109,12 @@ const registration = { if (!this.v$.$invalid) { try { - await this.signUp(this.user) - this.$router.push({ name: 'friends' }) + const status = await this.signUp(this.user) + if (status === 'ok') { + this.$router.push({ name: 'friends' }) + } else { + // display sign up notice, do not switch anywhere + } } catch (error) { console.warn('Registration failed: ', error) this.setCaptcha() diff --git a/src/components/registration/registration.vue b/src/components/registration/registration.vue index 7438a5f4..5c913f94 100644 --- a/src/components/registration/registration.vue +++ b/src/components/registration/registration.vue @@ -3,7 +3,10 @@
{{ $t('registration.registration') }}
-
+
+
+

+ {{ signUpNotice.message }} +

+
@@ -404,6 +412,10 @@ $validations-cRed: #f04124; } } +.registration-notice { + margin: 0.6em; +} + @media all and (max-width: 800px) { .registration-form .container { flex-direction: column-reverse; diff --git a/src/modules/users.js b/src/modules/users.js index 6467d732..b8f49f15 100644 --- a/src/modules/users.js +++ b/src/modules/users.js @@ -250,6 +250,7 @@ export const mutations = { signUpPending (state) { state.signUpPending = true state.signUpErrors = [] + state.signUpNotice = {} }, signUpSuccess (state) { state.signUpPending = false @@ -257,6 +258,12 @@ export const mutations = { signUpFailure (state, errors) { state.signUpPending = false state.signUpErrors = errors + state.signUpNotice = {} + }, + signUpNotice (state, notice) { + state.signUpPending = false + state.signUpErrors = [] + state.signUpNotice = notice } } @@ -287,6 +294,7 @@ export const defaultState = { usersByNameObject: {}, signUpPending: false, signUpErrors: [], + signUpNotice: {}, relationships: {} } @@ -524,9 +532,16 @@ const users = { const data = await rootState.api.backendInteractor.register( { params: { ...userInfo } } ) - store.commit('signUpSuccess') - store.commit('setToken', data.access_token) - store.dispatch('loginUser', data.access_token) + + if (data.access_token) { + store.commit('signUpSuccess') + store.commit('setToken', data.access_token) + store.dispatch('loginUser', data.access_token) + return 'ok' + } else { // Request succeeded, but user cannot login yet. + store.commit('signUpNotice', data) + return 'request_sent' + } } catch (e) { const errors = e.message store.commit('signUpFailure', errors) From 209c0a83325b9475b5ff9a4fd1ebede17d06ed63 Mon Sep 17 00:00:00 2001 From: tusooa Date: Sat, 13 Jan 2024 17:44:13 -0500 Subject: [PATCH 4/4] Remove empty else branch and detail the comments --- src/components/registration/registration.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/registration/registration.js b/src/components/registration/registration.js index ca1fed94..78d31980 100644 --- a/src/components/registration/registration.js +++ b/src/components/registration/registration.js @@ -112,9 +112,9 @@ const registration = { const status = await this.signUp(this.user) if (status === 'ok') { this.$router.push({ name: 'friends' }) - } else { - // display sign up notice, do not switch anywhere } + // If status is not 'ok' (i.e. it needs further actions to be done + // before you can login), display sign up notice, do not switch anywhere } catch (error) { console.warn('Registration failed: ', error) this.setCaptcha()