mirror of
https://github.com/element-hq/dendrite.git
synced 2025-09-14 05:12:26 +03:00
Replace membership and visibility values with constants (#774)
Signed-off-by: Alex Chen <minecnly@gmail.com>
This commit is contained in:
parent
d283676b9a
commit
f8d2860765
21 changed files with 51 additions and 65 deletions
|
@ -55,10 +55,6 @@ const (
|
|||
presetPublicChat = "public_chat"
|
||||
)
|
||||
|
||||
const (
|
||||
joinRulePublic = "public"
|
||||
joinRuleInvite = "invite"
|
||||
)
|
||||
const (
|
||||
historyVisibilityShared = "shared"
|
||||
// TODO: These should be implemented once history visibility is implemented
|
||||
|
@ -201,7 +197,7 @@ func createRoom(
|
|||
}
|
||||
|
||||
membershipContent := common.MemberContent{
|
||||
Membership: "join",
|
||||
Membership: gomatrixserverlib.Join,
|
||||
DisplayName: profile.DisplayName,
|
||||
AvatarURL: profile.AvatarURL,
|
||||
}
|
||||
|
@ -209,19 +205,19 @@ func createRoom(
|
|||
var joinRules, historyVisibility string
|
||||
switch r.Preset {
|
||||
case presetPrivateChat:
|
||||
joinRules = joinRuleInvite
|
||||
joinRules = gomatrixserverlib.Invite
|
||||
historyVisibility = historyVisibilityShared
|
||||
case presetTrustedPrivateChat:
|
||||
joinRules = joinRuleInvite
|
||||
joinRules = gomatrixserverlib.Invite
|
||||
historyVisibility = historyVisibilityShared
|
||||
// TODO If trusted_private_chat, all invitees are given the same power level as the room creator.
|
||||
case presetPublicChat:
|
||||
joinRules = joinRulePublic
|
||||
joinRules = gomatrixserverlib.Public
|
||||
historyVisibility = historyVisibilityShared
|
||||
default:
|
||||
// Default room rules, r.Preset was previously checked for valid values so
|
||||
// only a request with no preset should end up here.
|
||||
joinRules = joinRuleInvite
|
||||
joinRules = gomatrixserverlib.Invite
|
||||
historyVisibility = historyVisibilityShared
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue