From a2715877ef0c412d7c3c21dbf6cab470c86a3d22 Mon Sep 17 00:00:00 2001 From: Luis Mauro <1216941+lmauromb@users.noreply.github.com> Date: Thu, 7 Dec 2023 10:08:44 -0600 Subject: [PATCH] regression: FED-116 allow to invite rc users to fed channels (#30658) --- .changeset/nasty-islands-trade.md | 6 ++++++ apps/meteor/app/lib/server/functions/createRoom.ts | 1 + .../AddUsers/AddMatrixUsers/AddMatrixUsersModal.tsx | 6 +++++- .../AddUsers/AddMatrixUsers/useAddMatrixUsers.tsx | 8 +++++--- apps/meteor/ee/server/startup/services.ts | 2 +- apps/meteor/packages/rocketchat-i18n/i18n/en.i18n.json | 1 + .../src/v1/federation/FederationVerifyMatrixIdProps.ts | 2 ++ 7 files changed, 21 insertions(+), 5 deletions(-) create mode 100644 .changeset/nasty-islands-trade.md diff --git a/.changeset/nasty-islands-trade.md b/.changeset/nasty-islands-trade.md new file mode 100644 index 000000000000..b6df94282dd5 --- /dev/null +++ b/.changeset/nasty-islands-trade.md @@ -0,0 +1,6 @@ +--- +'@rocket.chat/rest-typings': minor +'@rocket.chat/meteor': minor +--- + +fix Federation Regression, builds service correctly diff --git a/apps/meteor/app/lib/server/functions/createRoom.ts b/apps/meteor/app/lib/server/functions/createRoom.ts index 312451f54845..3004dcd445ca 100644 --- a/apps/meteor/app/lib/server/functions/createRoom.ts +++ b/apps/meteor/app/lib/server/functions/createRoom.ts @@ -39,6 +39,7 @@ async function createUsersSubscriptions({ const extra: Partial = options?.subscriptionExtra || {}; extra.open = true; extra.ls = now; + extra.roles = ['owner']; if (room.prid) { extra.prid = room.prid; diff --git a/apps/meteor/client/views/room/contextualBar/RoomMembers/AddUsers/AddMatrixUsers/AddMatrixUsersModal.tsx b/apps/meteor/client/views/room/contextualBar/RoomMembers/AddUsers/AddMatrixUsers/AddMatrixUsersModal.tsx index 6703b14f2507..4ae17296a53e 100644 --- a/apps/meteor/client/views/room/contextualBar/RoomMembers/AddUsers/AddMatrixUsers/AddMatrixUsersModal.tsx +++ b/apps/meteor/client/views/room/contextualBar/RoomMembers/AddUsers/AddMatrixUsers/AddMatrixUsersModal.tsx @@ -34,6 +34,7 @@ const AddMatrixUsersModal = ({ onClose, matrixIdVerifiedStatus, onSave, complete const usersToInvite = completeUserList.filter( (user) => !(matrixIdVerifiedStatus.has(user) && matrixIdVerifiedStatus.get(user) === 'UNVERIFIED'), ); + const rocketChatUsers = usersToInvite.filter((user) => !matrixIdVerifiedStatus.has(user)); const { handleSubmit } = useForm({ defaultValues: { @@ -53,7 +54,7 @@ const AddMatrixUsersModal = ({ onClose, matrixIdVerifiedStatus, onSave, complete - Sending Invitations + {t('Continue_Adding')} @@ -65,6 +66,9 @@ const AddMatrixUsersModal = ({ onClose, matrixIdVerifiedStatus, onSave, complete {_matrixId}: ['name']} size='x20' /> ))} + {rocketChatUsers.map((_user) => ( +
  • {_user}
  • + ))} diff --git a/apps/meteor/client/views/room/contextualBar/RoomMembers/AddUsers/AddMatrixUsers/useAddMatrixUsers.tsx b/apps/meteor/client/views/room/contextualBar/RoomMembers/AddUsers/AddMatrixUsers/useAddMatrixUsers.tsx index 8e2ba65e02cb..023695633fed 100644 --- a/apps/meteor/client/views/room/contextualBar/RoomMembers/AddUsers/AddMatrixUsers/useAddMatrixUsers.tsx +++ b/apps/meteor/client/views/room/contextualBar/RoomMembers/AddUsers/AddMatrixUsers/useAddMatrixUsers.tsx @@ -20,9 +20,11 @@ export const useAddMatrixUsers = () => { try { let matrixIdVerificationMap = new Map(); const matrixIds = users.filter((user) => user.startsWith('@')); - const matrixIdsVerificationResponse = await dispatchVerifyEndpoint({ matrixIds }); - const { results: matrixIdsVerificationResults } = matrixIdsVerificationResponse; - matrixIdVerificationMap = new Map(Object.entries(matrixIdsVerificationResults)); + if (matrixIds.length > 0) { + const matrixIdsVerificationResponse = await dispatchVerifyEndpoint({ matrixIds }); + const { results: matrixIdsVerificationResults } = matrixIdsVerificationResponse; + matrixIdVerificationMap = new Map(Object.entries(matrixIdsVerificationResults)); + } setModal( { })(); await License.onLicense('federation', async () => { - const federationServiceEE = new FederationServiceEE(); + const federationServiceEE = await FederationServiceEE.createFederationService(); if (federationService) { api.destroyService(federationService); } diff --git a/apps/meteor/packages/rocketchat-i18n/i18n/en.i18n.json b/apps/meteor/packages/rocketchat-i18n/i18n/en.i18n.json index dc4a3387c6bd..4500de81f756 100644 --- a/apps/meteor/packages/rocketchat-i18n/i18n/en.i18n.json +++ b/apps/meteor/packages/rocketchat-i18n/i18n/en.i18n.json @@ -1143,6 +1143,7 @@ "Contact_Info": "Contact Information", "Content": "Content", "Continue": "Continue", + "Continue_Adding": "Continue Adding?", "Continuous_sound_notifications_for_new_livechat_room": "Continuous sound notifications for new omnichannel room", "convert-team": "Convert Team", "convert-team_description": "Permission to convert team to channel", diff --git a/packages/rest-typings/src/v1/federation/FederationVerifyMatrixIdProps.ts b/packages/rest-typings/src/v1/federation/FederationVerifyMatrixIdProps.ts index a6009fe20d85..df145849d9da 100644 --- a/packages/rest-typings/src/v1/federation/FederationVerifyMatrixIdProps.ts +++ b/packages/rest-typings/src/v1/federation/FederationVerifyMatrixIdProps.ts @@ -13,6 +13,8 @@ const FederationVerifyMatrixIdPropsSchema = { type: 'array', items: { type: 'string' }, uniqueItems: true, + minItems: 1, + maxItems: 15, }, }, additionalProperties: false,