🐛 Fix cannot list channel member when it related to realm

This commit is contained in:
LittleSheep 2024-05-08 21:57:57 +08:00
parent 32be79557a
commit 7e4ea47c61

View File

@ -11,7 +11,13 @@ import (
func listChannelMembers(c *fiber.Ctx) error {
alias := c.Params("channel")
channel, err := services.GetChannelWithAlias(alias)
var err error
var channel models.Channel
if val, ok := c.Locals("realm").(models.Realm); ok {
channel, err = services.GetChannelWithAlias(alias, val.ID)
} else {
channel, err = services.GetChannelWithAlias(alias)
}
if err != nil {
return fiber.NewError(fiber.StatusNotFound, err.Error())
}