Add option to allow inviting other users in portal rooms (#77)

This doesn't mean the invited users get bridged, but for some use cases that doesn't matter
This commit is contained in:
progserega 2019-07-16 19:16:17 +10:00 committed by Tulir Asokan
parent 29f5ae45c4
commit 92958343dd
3 changed files with 11 additions and 1 deletions

View file

@ -50,6 +50,8 @@ type BridgeConfig struct {
InviteOwnPuppetForBackfilling bool `yaml:"invite_own_puppet_for_backfilling"`
PrivateChatPortalMeta bool `yaml:"private_chat_portal_meta"`
AllowUserInvite bool `yaml:"allow_user_invite"`
CommandPrefix string `yaml:"command_prefix"`
Permissions PermissionConfig `yaml:"permissions"`

View file

@ -101,6 +101,10 @@ bridge:
# but causes room avatar/name bugs.
private_chat_portal_meta: false
# Allow invite permission for user. User can invite any bots to room with whatsapp
# users (private chat and groups)
allow_user_invite: false
# The prefix for commands. Only required in non-management rooms.
command_prefix: "!wa"

View file

@ -460,13 +460,17 @@ func (portal *Portal) Sync(user *User, contact whatsapp.Contact) {
func (portal *Portal) GetBasePowerLevels() *mautrix.PowerLevels {
anyone := 0
nope := 99
invite := 99
if portal.bridge.Config.Bridge.AllowUserInvite {
invite = 0
}
return &mautrix.PowerLevels{
UsersDefault: anyone,
EventsDefault: anyone,
RedactPtr: &anyone,
StateDefaultPtr: &nope,
BanPtr: &nope,
InvitePtr: &nope,
InvitePtr: &invite,
Users: map[string]int{
portal.MainIntent().UserID: 100,
},