remove NOOWNER, closes #14

This commit is contained in:
Aine
2022-08-29 20:21:37 +03:00
parent ba73b5a97c
commit e0bd71717c
6 changed files with 2 additions and 12 deletions

View File

@@ -34,7 +34,6 @@ env vars
<details>
<summary>other optional config parameters</summary>
* **POSTMOOGLE_NOOWNER** - allow change room settings by any room partisipant
* **POSTMOOGLE_NOENCRYPTION** - disable encryption support
* **POSTMOOGLE_STATUSMSG** - presence status message
* **POSTMOOGLE_SENTRY_DSN** - sentry DSN
@@ -81,6 +80,7 @@ If you want to change them - check available options in the help message (`!pm h
---
* **!pm mailboxes** - Show the list of all mailboxes
* **!pm delete** &lt;mailbox&gt; - Delete specific mailbox
</details>

View File

@@ -19,10 +19,6 @@ func (b *Bot) allowOwner(actorID id.UserID, targetRoomID id.RoomID) bool {
}
}
if b.noowner {
return true
}
cfg, err := b.getSettings(targetRoomID)
if err != nil {
b.Error(context.Background(), targetRoomID, "failed to retrieve settings: %v", err)

View File

@@ -17,7 +17,6 @@ import (
// Bot represents matrix bot
type Bot struct {
noowner bool
prefix string
domain string
allowedUsers []*regexp.Regexp
@@ -37,12 +36,10 @@ func New(
log *logger.Logger,
prefix string,
domain string,
noowner bool,
allowedUsers []*regexp.Regexp,
allowedAdmins []*regexp.Regexp,
) *Bot {
b := &Bot{
noowner: noowner,
prefix: prefix,
domain: domain,
allowedUsers: allowedUsers,

View File

@@ -87,7 +87,7 @@ func initBot(cfg *config.Config) {
// nolint // Fatal = panic, not os.Exit()
log.Fatal("cannot initialize matrix bot: %v", err)
}
mxb = bot.New(lp, mxlog, cfg.Prefix, cfg.Domain, cfg.NoOwner, cfg.Users, cfg.Admins)
mxb = bot.New(lp, mxlog, cfg.Prefix, cfg.Domain, cfg.Users, cfg.Admins)
log.Debug("bot has been created")
}

View File

@@ -33,7 +33,6 @@ func New() (*Config, error) {
Domain: env.String("domain", defaultConfig.Domain),
Port: env.String("port", defaultConfig.Port),
NoEncryption: env.Bool("noencryption"),
NoOwner: env.Bool("noowner"),
MaxSize: env.Int("maxsize", defaultConfig.MaxSize),
StatusMsg: env.String("statusmsg", defaultConfig.StatusMsg),
Users: userPatterns,

View File

@@ -18,8 +18,6 @@ type Config struct {
LogLevel string
// NoEncryption disabled encryption support
NoEncryption bool
// NoOwner allows room settings change by any participant
NoOwner bool
// Prefix for commands
Prefix string
// MaxSize of an email (including attachments)