commit 9ffa4d5ba3fb30f400575a7e2a6246df5e8e25c9 parent 742c0715cca9c8d80a7d1a4ae433969da7c558e6 Author: n0tr1v <n0tr1v@protonmail.com> Date: Thu, 10 Nov 2022 14:08:11 -0800 simplify code Diffstat:
| M | pkg/web/handlers/api/v1/slashInterceptor.go | | | 16 | +++++++++------- |
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/pkg/web/handlers/api/v1/slashInterceptor.go b/pkg/web/handlers/api/v1/slashInterceptor.go @@ -729,13 +729,15 @@ func handlePMCmd(c *Command) (handled bool) { return true } else if user.PmMode == database.PmModeStandard { - if !c.room.IsOwned() && !c.authUser.CanSendPM() { - // Need at least 1 karma to send PM from a public room - c.err = errors.New("not enough karma") - return true - } else if c.room.IsOwned() && !c.authUser.CanSendPM() { - // In private rooms, can send PM but inboxes will be skipped if not enough karma - c.skipInboxes = true + if !c.authUser.CanSendPM() { + if c.room.IsOwned() { + // In private rooms, can send PM but inboxes will be skipped if not enough karma + c.skipInboxes = true + } else { + // Need at least 1 karma to send PM from a public room + c.err = errors.New("not enough karma") + return true + } } if database.IsUserPmBlacklisted(c.authUser.ID, user.ID) {