From e275ea32e84bf58e9f3a09abb2727f37e71d1e10 Mon Sep 17 00:00:00 2001 From: Debdut Chakraborty Date: Mon, 4 Nov 2024 08:52:24 +0530 Subject: [PATCH 1/4] change federated user status to "Federated" --- .../admin/users/UsersTable/UsersTableRow.tsx | 50 +++++++++++++------ packages/i18n/src/locales/en.i18n.json | 1 + 2 files changed, 35 insertions(+), 16 deletions(-) diff --git a/apps/meteor/client/views/admin/users/UsersTable/UsersTableRow.tsx b/apps/meteor/client/views/admin/users/UsersTable/UsersTableRow.tsx index 47c08815c6f8..e473345147df 100644 --- a/apps/meteor/client/views/admin/users/UsersTable/UsersTableRow.tsx +++ b/apps/meteor/client/views/admin/users/UsersTable/UsersTableRow.tsx @@ -42,10 +42,28 @@ const UsersTableRow = ({ }: UsersTableRowProps): ReactElement => { const { t } = useTranslation(); - const { _id, emails, username = '', name = '', roles, status, active, avatarETag, lastLogin, type, freeSwitchExtension } = user; + const { + _id, + emails, + username = '', + name = '', + roles, + status, + active, + avatarETag, + lastLogin, + type, + freeSwitchExtension, + federated, + } = user; + const registrationStatusText = useMemo(() => { const usersExcludedFromPending = ['bot', 'app']; + if (federated) { + return t('Federated'); + } + if (!lastLogin && !usersExcludedFromPending.includes(type)) { return t('Pending'); } @@ -57,7 +75,7 @@ const UsersTableRow = ({ if (!active && lastLogin) { return t('Deactivated'); } - }, [active, lastLogin, t, type]); + }, [active, lastLogin, t, type, federated]); const roleNames = (roles || []) .map((roleId) => (Roles.findOne(roleId, { fields: { name: 1 } }) as IRole | undefined)?.name) @@ -93,26 +111,26 @@ const UsersTableRow = ({ }), ...(isNotPendingDeactivatedNorFederated && changeAdminStatusAction && { - makeAdmin: { - label: { label: changeAdminStatusAction.label, icon: changeAdminStatusAction.icon }, - action: changeAdminStatusAction.action, - }, - }), + makeAdmin: { + label: { label: changeAdminStatusAction.label, icon: changeAdminStatusAction.icon }, + action: changeAdminStatusAction.action, + }, + }), ...(isNotPendingDeactivatedNorFederated && resetE2EKeyAction && { - resetE2EKey: { label: { label: resetE2EKeyAction.label, icon: resetE2EKeyAction.icon }, action: resetE2EKeyAction.action }, - }), + resetE2EKey: { label: { label: resetE2EKeyAction.label, icon: resetE2EKeyAction.icon }, action: resetE2EKeyAction.action }, + }), ...(isNotPendingDeactivatedNorFederated && resetTOTPAction && { - resetTOTP: { label: { label: resetTOTPAction.label, icon: resetTOTPAction.icon }, action: resetTOTPAction.action }, - }), + resetTOTP: { label: { label: resetTOTPAction.label, icon: resetTOTPAction.icon }, action: resetTOTPAction.action }, + }), ...(changeUserStatusAction && !isFederatedUser && { - changeActiveStatus: { - label: { label: changeUserStatusAction.label, icon: changeUserStatusAction.icon }, - action: changeUserStatusAction.action, - }, - }), + changeActiveStatus: { + label: { label: changeUserStatusAction.label, icon: changeUserStatusAction.icon }, + action: changeUserStatusAction.action, + }, + }), ...(deleteUserAction && { delete: { label: { label: deleteUserAction.label, icon: deleteUserAction.icon }, action: deleteUserAction.action }, }), diff --git a/packages/i18n/src/locales/en.i18n.json b/packages/i18n/src/locales/en.i18n.json index 7965479ade61..fe1fd91efb17 100644 --- a/packages/i18n/src/locales/en.i18n.json +++ b/packages/i18n/src/locales/en.i18n.json @@ -2405,6 +2405,7 @@ "Federation_Matrix_serve_well_known_Alert": "Keep this off if using DNS srv records for federation, or use a reverse proxy to return static JSON if federation traffic is heavy. Read mode.", "Federation_Matrix_check_configuration": "Verify configuration", "Federation_Matrix_configuration_status": "Configuration status", + "Federated": "Federated", "Field": "Field", "Field_removed": "Field removed", "Field_required": "Field required", From 06fd42461ef186ab1ba06639fcc703b261e058a1 Mon Sep 17 00:00:00 2001 From: Debdut Chakraborty Date: Mon, 4 Nov 2024 11:21:42 +0530 Subject: [PATCH 2/4] lint baby --- .../admin/users/UsersTable/UsersTableRow.tsx | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/apps/meteor/client/views/admin/users/UsersTable/UsersTableRow.tsx b/apps/meteor/client/views/admin/users/UsersTable/UsersTableRow.tsx index e473345147df..39049f15d71f 100644 --- a/apps/meteor/client/views/admin/users/UsersTable/UsersTableRow.tsx +++ b/apps/meteor/client/views/admin/users/UsersTable/UsersTableRow.tsx @@ -111,26 +111,26 @@ const UsersTableRow = ({ }), ...(isNotPendingDeactivatedNorFederated && changeAdminStatusAction && { - makeAdmin: { - label: { label: changeAdminStatusAction.label, icon: changeAdminStatusAction.icon }, - action: changeAdminStatusAction.action, - }, - }), + makeAdmin: { + label: { label: changeAdminStatusAction.label, icon: changeAdminStatusAction.icon }, + action: changeAdminStatusAction.action, + }, + }), ...(isNotPendingDeactivatedNorFederated && resetE2EKeyAction && { - resetE2EKey: { label: { label: resetE2EKeyAction.label, icon: resetE2EKeyAction.icon }, action: resetE2EKeyAction.action }, - }), + resetE2EKey: { label: { label: resetE2EKeyAction.label, icon: resetE2EKeyAction.icon }, action: resetE2EKeyAction.action }, + }), ...(isNotPendingDeactivatedNorFederated && resetTOTPAction && { - resetTOTP: { label: { label: resetTOTPAction.label, icon: resetTOTPAction.icon }, action: resetTOTPAction.action }, - }), + resetTOTP: { label: { label: resetTOTPAction.label, icon: resetTOTPAction.icon }, action: resetTOTPAction.action }, + }), ...(changeUserStatusAction && !isFederatedUser && { - changeActiveStatus: { - label: { label: changeUserStatusAction.label, icon: changeUserStatusAction.icon }, - action: changeUserStatusAction.action, - }, - }), + changeActiveStatus: { + label: { label: changeUserStatusAction.label, icon: changeUserStatusAction.icon }, + action: changeUserStatusAction.action, + }, + }), ...(deleteUserAction && { delete: { label: { label: deleteUserAction.label, icon: deleteUserAction.icon }, action: deleteUserAction.action }, }), From 0a3557c350401d826e7d857a4eb7861790c95c79 Mon Sep 17 00:00:00 2001 From: Debdut Chakraborty Date: Mon, 4 Nov 2024 22:26:31 +0530 Subject: [PATCH 3/4] Create empty-pans-love.md --- .changeset/empty-pans-love.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changeset/empty-pans-love.md diff --git a/.changeset/empty-pans-love.md b/.changeset/empty-pans-love.md new file mode 100644 index 000000000000..a3ab8e26c8aa --- /dev/null +++ b/.changeset/empty-pans-love.md @@ -0,0 +1,6 @@ +--- +"@rocket.chat/meteor": patch +"@rocket.chat/i18n": patch +--- + +Fixes the incorrect registration status shown on admin users page for federated remote users. From b4c081037200a9096eb7b777551add129a7ad348 Mon Sep 17 00:00:00 2001 From: Debdut Chakraborty Date: Mon, 9 Dec 2024 12:37:31 +0530 Subject: [PATCH 4/4] mark federated users deactivated on the ui --- .../client/views/admin/users/UsersTable/UsersTableRow.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/meteor/client/views/admin/users/UsersTable/UsersTableRow.tsx b/apps/meteor/client/views/admin/users/UsersTable/UsersTableRow.tsx index 39049f15d71f..2442f8395d03 100644 --- a/apps/meteor/client/views/admin/users/UsersTable/UsersTableRow.tsx +++ b/apps/meteor/client/views/admin/users/UsersTable/UsersTableRow.tsx @@ -60,6 +60,10 @@ const UsersTableRow = ({ const registrationStatusText = useMemo(() => { const usersExcludedFromPending = ['bot', 'app']; + if (!active && lastLogin) { + return t('Deactivated'); + } + if (federated) { return t('Federated'); } @@ -71,10 +75,6 @@ const UsersTableRow = ({ if (active && lastLogin) { return t('Active'); } - - if (!active && lastLogin) { - return t('Deactivated'); - } }, [active, lastLogin, t, type, federated]); const roleNames = (roles || [])