🐛 Fix power level check doesn't work in channel with realm
This commit is contained in:
parent
edd02a03f7
commit
5b2fa00b1e
@ -2,6 +2,7 @@ package api
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"git.solsynth.dev/hydrogen/messaging/pkg/internal/gap"
|
||||
"git.solsynth.dev/hydrogen/messaging/pkg/internal/models"
|
||||
"git.solsynth.dev/hydrogen/messaging/pkg/internal/server/exts"
|
||||
@ -98,6 +99,8 @@ func newRawEvent(c *fiber.Ctx) error {
|
||||
channel, member, err = services.GetAvailableChannelWithAlias(alias, user, val.ID)
|
||||
if err != nil {
|
||||
return fiber.NewError(fiber.StatusNotFound, err.Error())
|
||||
} else if member.PowerLevel < 0 {
|
||||
return fiber.NewError(fiber.StatusForbidden, "you have not enough permission to send message")
|
||||
}
|
||||
} else {
|
||||
channel, member, err = services.GetAvailableChannelWithAlias(alias, user)
|
||||
|
@ -39,6 +39,8 @@ func newMessageEvent(c *fiber.Ctx) error {
|
||||
channel, member, err = services.GetAvailableChannelWithAlias(alias, user, val.ID)
|
||||
if err != nil {
|
||||
return fiber.NewError(fiber.StatusNotFound, err.Error())
|
||||
} else if member.PowerLevel < 0 {
|
||||
return fiber.NewError(fiber.StatusForbidden, "you have not enough permission to send message")
|
||||
}
|
||||
} else {
|
||||
channel, member, err = services.GetAvailableChannelWithAlias(alias, user)
|
||||
|
Loading…
Reference in New Issue
Block a user