Skip to content

Fix up "Test that invites can be rescinded over federation" - #803

Open
erikjohnston wants to merge 2 commits into
mainfrom
erikj/revoke_invite_fed
Open

Fix up "Test that invites can be rescinded over federation"#803
erikjohnston wants to merge 2 commits into
mainfrom
erikj/revoke_invite_fed

Conversation

@erikjohnston

@erikjohnstonerikjohnston commented Sep 8, 2025

Copy link
Copy Markdown
Member

Follows on from #797, which I merged Too Soon

c.f. element-hq/synapse#18823


// Check bob is still invited by doing an initial sync
bob.MustSyncUntil(t, client.SyncReq{}, client.SyncInvitedTo(bob.UserID, roomID2))
})

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion:

t.Run("Non-inviter user cannot rescind invite over federation", func(t*testing.T) {
t.Parallel()
//FirstcreatearoomthatBobisin. Thisissothatlaterwecan//sendamessagetotestthatBobdoesn'tseetherescission.
roomID1 :=alice.MustCreateRoom(t, map[string]interface{}{
"preset": "private_chat",
"invite": []string{bob.UserID},
})
since:=bob.MustSyncUntil(t, client.SyncReq{}, client.SyncInvitedTo(bob.UserID, roomID1))
bob.MustJoinRoom(t, roomID1, []spec.ServerName{})
//SecondroomwhichAliceandAlice2join, Alice2invitesBoband//thenAlicekickshim.
roomID2 :=alice.MustCreateRoom(t, map[string]interface{}{
"preset": "private_chat",
"invite": []string{alice2.UserID},
})
alice2.MustSyncUntil(t, client.SyncReq{}, client.SyncInvitedTo(alice2.UserID, roomID2))
alice2.MustJoinRoom(t, roomID2, []spec.ServerName{})
//`alice2`invitesbobalice2.MustInviteRoom(t, roomID2, bob.UserID)
bob.MustSyncUntil(t, client.SyncReq{}, client.SyncInvitedTo(bob.UserID, roomID2))
//`alice`, nottheoriginalinviter (`alice2`), kicksbob.
alice.MustDo(t, "POST", []string{"_matrix", "client", "v3", "rooms", roomID2, "kick"},
client.WithJSONBody(t, map[string]interface{}{
"user_id": bob.UserID,
"reason": "testing",
}),
)
//Checkbob*doesn't*seetherescission. Wedothisbysendingamessagein//`roomID1` (onthesamehomeserveras`roomID2`) andcheckingthatonceBob//receivesthatnewmessagein`roomID1`hestillhasn'tseentheleavefor`roomID2`.
////Ideally, bobcouldseetherescission, butcurrentlywehavenowaytoauth//thatoverfederation.
eventID :=alice.SendEventSynced(t, roomID1, b.Event{
Type: "m.room.message",
Content: map[string]interface{}{
"body": "1",
"msgtype": "m.text",
},
Sender: alice.UserID,
})
bob.MustSyncUntil(t, client.SyncReq{Since: since}, client.SyncTimelineHasEventID(roomID1, eventID))
//Checkbobisstillinvitedto`roomID2`bydoinganinitialsyncbob.MustSyncUntil(t, client.SyncReq{}, client.SyncInvitedTo(bob.UserID, roomID2))
})

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@erikjohnston@MadLittleMods