Report who sent each pending invite - #21
Merged
Merged
Conversation
mx_extract_invites() gives room ids and nothing else, and an invite's sender is the whole of whether it should be accepted: auto-joining anyone's invite hands a stranger a session with whatever the client can do. A caller that wanted to decide had to walk invite_state itself, which corteza does today. mx_extract_invite_records() returns list(room_id, inviter). inviter is NA when the stripped state carries no m.room.member event for self_id, rather than being guessed at, so a caller gating on it can tell 'nobody I trust' from 'I could not tell'. Both refuse; they are different reasons, and only one of them is worth a message. No timestamp. Stripped state has no reliable origin_server_ts, and an invite is a standing state rather than an event at a moment -- a field that could only ever be NA is worse than no field. 197 assertions. Three mutations, all caught: matching a membership event for someone other than self_id, matching a join or leave as though it were an invite, and reporting a missing sender as NULL rather than NA.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Groundwork for chat.api phase 1d (
chat_poll()$invites+chat_join()), which is the change that removes corteza's last$rawreach-through.mx_extract_invites()returns room ids and nothing else. An invite's sender is the whole of whether it should be accepted — auto-joining anyone's invite hands a stranger a session with whatever the client can do — so a caller that wants to decide has to walkinvite_stateitself. corteza does exactly that today, inmatrix_invite_inviters(), which is Matrix sync-shape knowledge sitting two packages away from the sync.mx_extract_invite_records(sync_resp, self_id)returnslist(room_id, inviter).The NA
inviteris NA when the stripped state carries nom.room.memberevent forself_id, rather than being guessed at or omitted. A caller gating on the sender can then tell "nobody I trust" from "I could not tell". Both refuse — but they are different reasons, and only one is worth logging as a rejection.No timestamp
Stripped state has no reliable
origin_server_ts, and an invite is a standing state rather than an event at a moment. A field that could only ever be NA is worse than no field, so there isn't one. That is the one place this record deliberately differs fromchat_message()andchat_reaction().Testing
197 assertions. Three mutations, all caught: matching a membership event for someone other than
self_id, matching a join or a leave as though it were an invite, and reporting a missing sender as NULL rather than NA.mx_extract_invites()is unchanged and still exported — the new function's room ids are asserted to agree with it.R CMD check --as-cranclean but for the days-since-last-update NOTE.