From 4c72ff46250d130b088c80d063a53a1f37c917dd Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Sat, 16 Jan 2021 10:20:38 -0600 Subject: [PATCH 01/28] AdminAPI: change from confirmation_pending to is_confirmed --- src/api/__mocks__/login.js | 2 +- src/store/modules/users.js | 2 +- src/views/users/components/ModerationDropdown.vue | 4 ++-- src/views/users/components/MultipleUsersMenu.vue | 4 ++-- src/views/users/index.vue | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/api/__mocks__/login.js b/src/api/__mocks__/login.js index a980f88b..31591f7b 100644 --- a/src/api/__mocks__/login.js +++ b/src/api/__mocks__/login.js @@ -43,7 +43,7 @@ export function getUserInfo(token, authHost) { 'statuses_count': 0, 'cover_photo': '', 'hide_follows': false, - 'pleroma': { 'confirmation_pending': false, 'deactivated': false, 'tags': ['force_nsfw'], 'is_admin': true }, + 'pleroma': { 'is_confirmed': true, 'deactivated': false, 'tags': ['force_nsfw'], 'is_admin': true }, 'profile_image_url_original': '', 'created_at': 'Fri Mar 01 15:15:19 +0000 2019', 'fields': [], diff --git a/src/store/modules/users.js b/src/store/modules/users.js index 29b98fcf..a9477323 100644 --- a/src/store/modules/users.js +++ b/src/store/modules/users.js @@ -149,7 +149,7 @@ const users = { }, async ConfirmUsersEmail({ dispatch, getters }, { users, _userId, _statusId }) { const updatedUsers = users.map(user => { - return { ...user, confirmation_pending: false } + return { ...user, is_confirmed: true } }) const nicknames = users.map(user => user.nickname) const callApiFn = async() => await confirmUserEmail(nicknames, getters.authHost, getters.token) diff --git a/src/views/users/components/ModerationDropdown.vue b/src/views/users/components/ModerationDropdown.vue index d54efe43..64aa75f6 100644 --- a/src/views/users/components/ModerationDropdown.vue +++ b/src/views/users/components/ModerationDropdown.vue @@ -57,13 +57,13 @@ {{ $t('users.rejectAccount') }} {{ $t('users.confirmAccount') }} {{ $t('users.resendConfirmation') }} diff --git a/src/views/users/components/MultipleUsersMenu.vue b/src/views/users/components/MultipleUsersMenu.vue index bdf65006..8446bbb0 100644 --- a/src/views/users/components/MultipleUsersMenu.vue +++ b/src/views/users/components/MultipleUsersMenu.vue @@ -244,13 +244,13 @@ export default { applyAction(filtered, approveAccountFn) }, confirmAccounts: () => { - const filtered = this.selectedUsers.filter(user => this.isLocalUser(user) && user.confirmation_pending) + const filtered = this.selectedUsers.filter(user => this.isLocalUser(user) && !user.is_confirmed) const confirmAccountFn = async(users) => await this.$store.dispatch('ConfirmUsersEmail', { users }) applyAction(filtered, confirmAccountFn) }, resendConfirmation: () => { - const filtered = this.selectedUsers.filter(user => this.isLocalUser(user) && user.confirmation_pending) + const filtered = this.selectedUsers.filter(user => this.isLocalUser(user) && !user.is_confirmed) const resendConfirmationFn = async(users) => await this.$store.dispatch('ResendConfirmationEmail', users) applyAction(filtered, resendConfirmationFn) diff --git a/src/views/users/index.vue b/src/views/users/index.vue index 4baaed01..d20161b4 100644 --- a/src/views/users/index.vue +++ b/src/views/users/index.vue @@ -77,7 +77,7 @@ {{ isDesktop ? $t('users.moderator') : getFirstLetter($t('users.moderator')) }} - + {{ isDesktop ? $t('users.unconfirmed') : getFirstLetter($t('users.unconfirmed')) }} From 61d173549e8437ef133f184e166a24b3d4a1a8ed Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Sat, 16 Jan 2021 10:36:30 -0600 Subject: [PATCH 02/28] Fix mocks --- src/api/__mocks__/chat.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/api/__mocks__/chat.js b/src/api/__mocks__/chat.js index 946673b1..75692ea7 100644 --- a/src/api/__mocks__/chat.js +++ b/src/api/__mocks__/chat.js @@ -44,7 +44,7 @@ export const userChats = [ accepts_chat_messages: true, ap_id: 'http://localhost:4000/users/test10', background_image: null, - confirmation_pending: false, + is_confirmed: true, favicon: null, hide_favorites: true, hide_followers: false, @@ -99,7 +99,7 @@ export const userChats = [ accepts_chat_messages: true, ap_id: 'https://localhost/users/mk', background_image: null, - confirmation_pending: false, + is_confirmed: true, favicon: null, hide_favorites: true, hide_followers: false, @@ -168,7 +168,7 @@ export const userChats = [ accepts_chat_messages: true, ap_id: 'http://localhost:4000/users/user2', background_image: null, - confirmation_pending: true, + is_confirmed: false, favicon: null, hide_favorites: true, hide_followers: false, @@ -222,7 +222,7 @@ export const userChats = [ accepts_chat_messages: true, ap_id: 'https://localhost/users/mk', background_image: null, - confirmation_pending: false, + is_confirmed: true, favicon: null, hide_favorites: true, hide_followers: false, @@ -286,7 +286,7 @@ export const userChats = [ accepts_chat_messages: true, ap_id: 'https://localhost/users/mk', background_image: null, - confirmation_pending: false, + is_confirmed: true, favicon: null, hide_favorites: true, hide_followers: false, @@ -344,7 +344,7 @@ export const userChats = [ accepts_chat_messages: true, ap_id: 'https://localhost/users/mk', background_image: null, - confirmation_pending: false, + is_confirmed: true, favicon: null, hide_favorites: true, hide_followers: false, From a549e5291dfb101c58974f49b0f4f2ec7ba96806 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Sat, 16 Jan 2021 10:48:56 -0600 Subject: [PATCH 03/28] Document breakage --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a2f8d43c..658ec70d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,8 +15,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Filter users by actor type: Person, Bot or Application - Add ability to configure Media Preview Proxy, User Backup, Websocket based federation and Pleroma.Web.Endpoint.MetricsExporter settings - Mobile and Tablet UI for Single Report show page + ### Changed +- *Breaking*: AdminAPI changed User field `confirmation_pending` to `is_confirmed` - Hide Tag actions on Users tab if MRF TagPolicy is disabled. Add ability to enable TagPolicy from Moderation menu - Move `:restrict_unauthenticated` settings from Authentication tab to Instance tab - Replace regular inputs with textareas for setting welcome messages in the Settings section From a8cf3a75bab949a175553b7076a70a0f038615db Mon Sep 17 00:00:00 2001 From: Angelina Filippova Date: Sun, 17 Jan 2021 00:58:03 +0300 Subject: [PATCH 04/28] Add is_confirmed flag to mocked users in tests --- src/api/__mocks__/users.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/api/__mocks__/users.js b/src/api/__mocks__/users.js index a389d7f4..c06bff67 100644 --- a/src/api/__mocks__/users.js +++ b/src/api/__mocks__/users.js @@ -1,12 +1,12 @@ import userChats from './chat' export let users = [ - { active: true, approval_pending: false, deactivated: false, id: '2', nickname: 'allis', local: true, external: false, roles: { admin: true, moderator: false }, tags: [], actor_type: 'Person' }, - { active: true, approval_pending: false, deactivated: false, id: '10', nickname: 'bob', local: true, external: false, roles: { admin: false, moderator: false }, tags: ['mrf_tag:sandbox'], actor_type: 'Person' }, - { active: true, approval_pending: true, deactivated: false, id: '567', nickname: 'ded', local: false, external: true, roles: { admin: false, moderator: false }, tags: [], actor_type: 'Person' }, - { active: false, approval_pending: false, deactivated: true, id: 'abc', nickname: 'john', local: true, external: false, roles: { admin: false, moderator: false }, tags: ['mrf_tag:media-strip'], actor_type: 'Person' }, - { active: true, approval_pending: true, deactivated: false, id: '100', nickname: 'sally', local: true, external: false, roles: { admin: false, moderator: false }, tags: [], actor_type: 'Service' }, - { active: true, approval_pending: true, deactivated: false, id: '123', nickname: 'bot', local: true, external: false, roles: { admin: false, moderator: false }, tags: [], actor_type: 'Application' } + { active: true, is_confirmed: true, approval_pending: false, deactivated: false, id: '2', nickname: 'allis', local: true, external: false, roles: { admin: true, moderator: false }, tags: [], actor_type: 'Person' }, + { active: true, is_confirmed: true, approval_pending: false, deactivated: false, id: '10', nickname: 'bob', local: true, external: false, roles: { admin: false, moderator: false }, tags: ['mrf_tag:sandbox'], actor_type: 'Person' }, + { active: true, is_confirmed: true, approval_pending: true, deactivated: false, id: '567', nickname: 'ded', local: false, external: true, roles: { admin: false, moderator: false }, tags: [], actor_type: 'Person' }, + { active: false, is_confirmed: true, approval_pending: false, deactivated: true, id: 'abc', nickname: 'john', local: true, external: false, roles: { admin: false, moderator: false }, tags: ['mrf_tag:media-strip'], actor_type: 'Person' }, + { active: true, is_confirmed: true, approval_pending: true, deactivated: false, id: '100', nickname: 'sally', local: true, external: false, roles: { admin: false, moderator: false }, tags: [], actor_type: 'Service' }, + { active: true, is_confirmed: true, approval_pending: true, deactivated: false, id: '123', nickname: 'bot', local: true, external: false, roles: { admin: false, moderator: false }, tags: [], actor_type: 'Application' } ] const userProfile = { avatar: 'avatar.jpg', nickname: 'allis', id: '2', tags: [], roles: { admin: true, moderator: false }, local: true, external: false } From 30b14142c7eaf7fe6d7046c946bcdc8a8f78e6af Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Mon, 18 Jan 2021 12:24:01 -0600 Subject: [PATCH 05/28] Consistent style with pleroma/pleroma changelog for breaking changes --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 658ec70d..a096958b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,7 +18,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Changed -- *Breaking*: AdminAPI changed User field `confirmation_pending` to `is_confirmed` +- **Breaking**: AdminAPI changed User field `confirmation_pending` to `is_confirmed` - Hide Tag actions on Users tab if MRF TagPolicy is disabled. Add ability to enable TagPolicy from Moderation menu - Move `:restrict_unauthenticated` settings from Authentication tab to Instance tab - Replace regular inputs with textareas for setting welcome messages in the Settings section From 3df5aebadf3dd8ec393687f54531dc025c5b23be Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Mon, 18 Jan 2021 12:24:35 -0600 Subject: [PATCH 06/28] AdminAPI: change from approval_pending to is_approved --- src/api/__mocks__/users.js | 14 +++++++------- src/store/modules/users.js | 2 +- src/views/users/components/ModerationDropdown.vue | 4 ++-- src/views/users/components/MultipleUsersMenu.vue | 2 +- src/views/users/index.vue | 6 +++--- src/views/users/show.vue | 4 ++-- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/api/__mocks__/users.js b/src/api/__mocks__/users.js index c06bff67..6dec1f5f 100644 --- a/src/api/__mocks__/users.js +++ b/src/api/__mocks__/users.js @@ -1,12 +1,12 @@ import userChats from './chat' export let users = [ - { active: true, is_confirmed: true, approval_pending: false, deactivated: false, id: '2', nickname: 'allis', local: true, external: false, roles: { admin: true, moderator: false }, tags: [], actor_type: 'Person' }, - { active: true, is_confirmed: true, approval_pending: false, deactivated: false, id: '10', nickname: 'bob', local: true, external: false, roles: { admin: false, moderator: false }, tags: ['mrf_tag:sandbox'], actor_type: 'Person' }, - { active: true, is_confirmed: true, approval_pending: true, deactivated: false, id: '567', nickname: 'ded', local: false, external: true, roles: { admin: false, moderator: false }, tags: [], actor_type: 'Person' }, - { active: false, is_confirmed: true, approval_pending: false, deactivated: true, id: 'abc', nickname: 'john', local: true, external: false, roles: { admin: false, moderator: false }, tags: ['mrf_tag:media-strip'], actor_type: 'Person' }, - { active: true, is_confirmed: true, approval_pending: true, deactivated: false, id: '100', nickname: 'sally', local: true, external: false, roles: { admin: false, moderator: false }, tags: [], actor_type: 'Service' }, - { active: true, is_confirmed: true, approval_pending: true, deactivated: false, id: '123', nickname: 'bot', local: true, external: false, roles: { admin: false, moderator: false }, tags: [], actor_type: 'Application' } + { active: true, is_confirmed: true, is_approved: true, deactivated: false, id: '2', nickname: 'allis', local: true, external: false, roles: { admin: true, moderator: false }, tags: [], actor_type: 'Person' }, + { active: true, is_confirmed: true, is_approved: true, deactivated: false, id: '10', nickname: 'bob', local: true, external: false, roles: { admin: false, moderator: false }, tags: ['mrf_tag:sandbox'], actor_type: 'Person' }, + { active: true, is_confirmed: true, is_approved: false, deactivated: false, id: '567', nickname: 'ded', local: false, external: true, roles: { admin: false, moderator: false }, tags: [], actor_type: 'Person' }, + { active: false, is_confirmed: true, is_approved: true, deactivated: true, id: 'abc', nickname: 'john', local: true, external: false, roles: { admin: false, moderator: false }, tags: ['mrf_tag:media-strip'], actor_type: 'Person' }, + { active: true, is_confirmed: true, is_approved: false, deactivated: false, id: '100', nickname: 'sally', local: true, external: false, roles: { admin: false, moderator: false }, tags: [], actor_type: 'Service' }, + { active: true, is_confirmed: true, is_approved: false, deactivated: false, id: '123', nickname: 'bot', local: true, external: false, roles: { admin: false, moderator: false }, tags: [], actor_type: 'Application' } ] const userProfile = { avatar: 'avatar.jpg', nickname: 'allis', id: '2', tags: [], roles: { admin: true, moderator: false }, local: true, external: false } @@ -104,7 +104,7 @@ export async function deactivateUsers(nicknames, authHost, token) { export async function approveUserAccount(nicknames, authHost, token) { const response = nicknames.map(nickname => { const currentUser = users.find(user => user.nickname === nickname) - return { ...currentUser, approval_pending: false } + return { ...currentUser, is_approved: true } }) return Promise.resolve({ data: response }) } diff --git a/src/store/modules/users.js b/src/store/modules/users.js index a9477323..a1e0f9fe 100644 --- a/src/store/modules/users.js +++ b/src/store/modules/users.js @@ -132,7 +132,7 @@ const users = { }, async ApproveUsersAccount({ dispatch, getters }, { users, _userId, _statusId }) { const updatedUsers = users.map(user => { - return { ...user, approval_pending: false } + return { ...user, is_approved: true } }) const nicknames = users.map(user => user.nickname) const callApiFn = async() => await approveUserAccount(nicknames, getters.authHost, getters.token) diff --git a/src/views/users/components/ModerationDropdown.vue b/src/views/users/components/ModerationDropdown.vue index 64aa75f6..b0edf557 100644 --- a/src/views/users/components/ModerationDropdown.vue +++ b/src/views/users/components/ModerationDropdown.vue @@ -46,13 +46,13 @@ {{ $t('users.deleteAccount') }} {{ $t('users.approveAccount') }} {{ $t('users.rejectAccount') }} diff --git a/src/views/users/components/MultipleUsersMenu.vue b/src/views/users/components/MultipleUsersMenu.vue index 8446bbb0..07aaf8ec 100644 --- a/src/views/users/components/MultipleUsersMenu.vue +++ b/src/views/users/components/MultipleUsersMenu.vue @@ -238,7 +238,7 @@ export default { applyAction(filtered, requirePasswordResetFn) }, approveAccounts: () => { - const filtered = this.selectedUsers.filter(user => this.isLocalUser(user) && user.approval_pending) + const filtered = this.selectedUsers.filter(user => this.isLocalUser(user) && !user.is_approved) const approveAccountFn = async(users) => await this.$store.dispatch('ApproveUsersAccount', { users }) applyAction(filtered, approveAccountFn) diff --git a/src/views/users/index.vue b/src/views/users/index.vue index d20161b4..14270e10 100644 --- a/src/views/users/index.vue +++ b/src/views/users/index.vue @@ -56,16 +56,16 @@