From 2849080417c10719e0f6064532d99cce2f1b95b7 Mon Sep 17 00:00:00 2001 From: Tristian Celestin Date: Sun, 23 Mar 2025 10:00:47 -0400 Subject: [PATCH] Add check to confirm that state preset is effectively private when present and visibility are unset --- clientapi/clientapi_test.go | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/clientapi/clientapi_test.go b/clientapi/clientapi_test.go index ad2d4ad4..cf86e024 100644 --- a/clientapi/clientapi_test.go +++ b/clientapi/clientapi_test.go @@ -2330,8 +2330,23 @@ func TestCreateRoomInvite(t *testing.T) { roomID := gjson.GetBytes(w.Body.Bytes(), "room_id").Str validRoomID, _ := spec.NewRoomID(roomID) + + // Confirm that the room matches the private state preset + ev, err := rsAPI.CurrentStateEvent(context.Background(), *validRoomID, spec.MRoomJoinRules, spec.Invite) + if err != nil { + t.Fatal(err) + } + ev, err = rsAPI.CurrentStateEvent(context.Background(), *validRoomID, spec.MRoomHistoryVisibility, string(gomatrixserverlib.HistoryVisibilityShared)) + if err != nil { + t.Fatal(err) + } + ev, err = rsAPI.CurrentStateEvent(context.Background(), *validRoomID, spec.MRoomGuestAccess, "can_join") + if err != nil { + t.Fatal(err) + } + // Now ask the roomserver about the membership event of Bob - ev, err := rsAPI.CurrentStateEvent(context.Background(), *validRoomID, spec.MRoomMember, bob.ID) + ev, err = rsAPI.CurrentStateEvent(context.Background(), *validRoomID, spec.MRoomMember, bob.ID) if err != nil { t.Fatal(err) }