[FIX] creating room with federated member (#23347)

* Fix creating room with federated member

When creating a room with a federated member the local user only has the attributes "_id" and "username" for the event normalizeUser.
In there the attribute emails is called but only defined two lines down.
Moved the definition before the call to resolve  "undefined user" error message on room creation.

* remove empty line (no traling spaces)
pull/23957/head
qwertiko GmbH 3 years ago committed by GitHub
parent 008310e950
commit e1c527a594
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      app/federation/server/normalizers/user.js

@ -27,11 +27,10 @@ const normalizeUser = (originalResource) => {
// Get only what we need, non-sensitive data
const resource = _.pick(originalResource, '_id', 'username', 'type', 'emails', 'name', 'federation', 'isRemote', 'createdAt', '_updatedAt');
const email = resource.emails[0].address;
resource.emails = [{
address: `${ resource._id }@${ getFederationDomain() }`,
}];
const email = resource.emails[0].address;
resource.active = true;
resource.roles = ['user'];

Loading…
Cancel
Save