Update code as suggested

This commit is contained in:
Till Faelligen 2025-06-19 08:13:43 +02:00
parent 814fff5d4f
commit 6d1c47d2a0
No known key found for this signature in database
GPG key ID: 3DF82D8AB9211D4E

View file

@ -114,6 +114,10 @@ func (c *Creator) PerformCreateRoom(ctx context.Context, userID spec.UserID, roo
}
var guestsCanJoin bool
// If unspecified, the server should use the visibility to determine which preset to use.
// A visibility of public equates to a preset of public_chat
// and private visibility equates to a preset of private_chat.
if createRequest.StatePreset == "" {
switch createRequest.Visibility {
case "private", "":
@ -121,7 +125,7 @@ func (c *Creator) PerformCreateRoom(ctx context.Context, userID spec.UserID, roo
case "public":
createRequest.StatePreset = spec.PresetPublicChat
}
} else {
}
switch createRequest.StatePreset {
case spec.PresetPrivateChat:
joinRuleContent.JoinRule = spec.Invite
@ -138,7 +142,6 @@ func (c *Creator) PerformCreateRoom(ctx context.Context, userID spec.UserID, roo
joinRuleContent.JoinRule = spec.Public
historyVisibilityContent.HistoryVisibility = historyVisibilityShared
}
}
createEvent := gomatrixserverlib.FledglingEvent{
Type: spec.MRoomCreate,
Content: createContent,