Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(federation-v2): don't throw on username validation before creating dm #33280

Merged
merged 11 commits into from
Dec 17, 2024
5 changes: 5 additions & 0 deletions .changeset/fifty-parrots-wonder.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/meteor': patch
---

Fixed an issue where normal direct message rooms could not be created due to invalid federation configuration.
debdutdeb marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,10 @@ export class FederationHooks {
callbacks.add(
'federation.beforeCreateDirectMessage',
async (members: IUser[]): Promise<void> => {
if (!members) {
if (!members || !isFederationEnabled()) {
return;
}

throwIfFederationNotEnabledOrNotReady();

await callback(members);
},
callbacks.priority.HIGH,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ describe('Federation - Infrastructure - RocketChat - Hooks', () => {
it('should execute the callback when everything is correct', () => {
const stub = sinon.stub();
FederationHooks.canCreateDirectMessageFromUI(stub);
isFederationEnabled.returns(true);
hooks['federation-v2-can-create-direct-message-from-ui-ce']([]);
expect(stub.calledWith([])).to.be.true;
});
debdutdeb marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
Loading