mirror of
https://github.com/element-hq/dendrite.git
synced 2025-09-14 05:12:26 +03:00
Update code as suggested
This commit is contained in:
parent
814fff5d4f
commit
6d1c47d2a0
1 changed files with 19 additions and 16 deletions
|
@ -114,6 +114,10 @@ func (c *Creator) PerformCreateRoom(ctx context.Context, userID spec.UserID, roo
|
||||||
}
|
}
|
||||||
|
|
||||||
var guestsCanJoin bool
|
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 == "" {
|
if createRequest.StatePreset == "" {
|
||||||
switch createRequest.Visibility {
|
switch createRequest.Visibility {
|
||||||
case "private", "":
|
case "private", "":
|
||||||
|
@ -121,23 +125,22 @@ func (c *Creator) PerformCreateRoom(ctx context.Context, userID spec.UserID, roo
|
||||||
case "public":
|
case "public":
|
||||||
createRequest.StatePreset = spec.PresetPublicChat
|
createRequest.StatePreset = spec.PresetPublicChat
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
switch createRequest.StatePreset {
|
switch createRequest.StatePreset {
|
||||||
case spec.PresetPrivateChat:
|
case spec.PresetPrivateChat:
|
||||||
joinRuleContent.JoinRule = spec.Invite
|
joinRuleContent.JoinRule = spec.Invite
|
||||||
historyVisibilityContent.HistoryVisibility = historyVisibilityShared
|
historyVisibilityContent.HistoryVisibility = historyVisibilityShared
|
||||||
guestsCanJoin = true
|
guestsCanJoin = true
|
||||||
case spec.PresetTrustedPrivateChat:
|
case spec.PresetTrustedPrivateChat:
|
||||||
joinRuleContent.JoinRule = spec.Invite
|
joinRuleContent.JoinRule = spec.Invite
|
||||||
historyVisibilityContent.HistoryVisibility = historyVisibilityShared
|
historyVisibilityContent.HistoryVisibility = historyVisibilityShared
|
||||||
for _, invitee := range createRequest.InvitedUsers {
|
for _, invitee := range createRequest.InvitedUsers {
|
||||||
powerLevelContent.Users[invitee] = 100
|
powerLevelContent.Users[invitee] = 100
|
||||||
}
|
|
||||||
guestsCanJoin = true
|
|
||||||
case spec.PresetPublicChat:
|
|
||||||
joinRuleContent.JoinRule = spec.Public
|
|
||||||
historyVisibilityContent.HistoryVisibility = historyVisibilityShared
|
|
||||||
}
|
}
|
||||||
|
guestsCanJoin = true
|
||||||
|
case spec.PresetPublicChat:
|
||||||
|
joinRuleContent.JoinRule = spec.Public
|
||||||
|
historyVisibilityContent.HistoryVisibility = historyVisibilityShared
|
||||||
}
|
}
|
||||||
createEvent := gomatrixserverlib.FledglingEvent{
|
createEvent := gomatrixserverlib.FledglingEvent{
|
||||||
Type: spec.MRoomCreate,
|
Type: spec.MRoomCreate,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue