-
Notifications
You must be signed in to change notification settings - Fork 75
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
Handle pre-shared invite keys #271
Conversation
Signed-off-by: Andrew Ferrazzutti <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the other thing I'm not sure on is whether this is actually recommended by the spec/rust-sdk - it doesn't appear to come up in documentation, though I'm willing to admit I might be blind.
FWIW this is the behaviour Element Web uses. If you've invited a user with an encryption-enabled device to an encrypted room, EW will send the room key to that user (via a to-device message) even before they've joined the room. In fact, it sends the key even before you post a message -- it sends it as soon as you starting typing a message! |
Treat an error in looking up room members of a particular membership type as there being no members of that type. Return early if no members are found.
* Handle pre-shared invite keys Signed-off-by: Andrew Ferrazzutti <[email protected]> * Use assignment for changes to membership array * Catch member lookup errors in prepareEncrypt Treat an error in looking up room members of a particular membership type as there being no members of that type. Return early if no members are found. * Resolve conflict on `members` variable Signed-off-by: Andrew Ferrazzutti <[email protected]>
* Handle pre-shared invite keys Signed-off-by: Andrew Ferrazzutti <[email protected]> * Use assignment for changes to membership array * Catch member lookup errors in prepareEncrypt Treat an error in looking up room members of a particular membership type as there being no members of that type. Return early if no members are found. * Resolve conflict on `members` variable Signed-off-by: Andrew Ferrazzutti <[email protected]>
* Handle pre-shared invite keys Signed-off-by: Andrew Ferrazzutti <[email protected]> * Use assignment for changes to membership array * Catch member lookup errors in prepareEncrypt Treat an error in looking up room members of a particular membership type as there being no members of that type. Return early if no members are found. * Resolve conflict on `members` variable Signed-off-by: Andrew Ferrazzutti <[email protected]>
* Handle pre-shared invite keys Signed-off-by: Andrew Ferrazzutti <[email protected]> * Use assignment for changes to membership array * Catch member lookup errors in prepareEncrypt Treat an error in looking up room members of a particular membership type as there being no members of that type. Return early if no members are found. * Resolve conflict on `members` variable Signed-off-by: Andrew Ferrazzutti <[email protected]>
* Handle pre-shared invite keys Signed-off-by: Andrew Ferrazzutti <[email protected]> * Use assignment for changes to membership array * Catch member lookup errors in prepareEncrypt Treat an error in looking up room members of a particular membership type as there being no members of that type. Return early if no members are found. * Resolve conflict on `members` variable Signed-off-by: Andrew Ferrazzutti <[email protected]>
.map(u => new UserId(u.membershipFor)) | ||
.forEach(u => void members.add(u)); | ||
} catch (err) { | ||
LogService.warn("RustEngine", `Failed to get room members for membership type "${membership}" in ${roomId}`, extractRequestError(err)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure we should be consuming this error tbh
try { | ||
(await this.client.getRoomMembersByMembership(roomId, membership)) | ||
.map(u => new UserId(u.membershipFor)) | ||
.forEach(u => void members.add(u)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
preferably we use a real for
loop for this, as one-liners mixed in with try/catch is a bit confusing imo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also, we shouldn't need a Set
here as someone can't exist in two states. Appending to an array (using push(...userIds)
) should be fine?
Signed-off-by: Andrew Ferrazzutti [email protected]
Checklist