diff --git a/pkg/server/channels_api.go b/pkg/server/channels_api.go index 9e4dbaa..44bcaec 100644 --- a/pkg/server/channels_api.go +++ b/pkg/server/channels_api.go @@ -79,7 +79,7 @@ func createChannel(c *fiber.Ctx) error { var realm *models.Realm if val, ok := c.Locals("realm").(models.Realm); ok { - if info, err := services.GetRealmMember(val.ID, user.ExternalID); err != nil { + if info, err := services.GetRealmMember(val.ExternalID, user.ExternalID); err != nil { return fmt.Errorf("you must be a part of that realm then can create channel related to it") } else if info.GetPowerLevel() < 50 { return fmt.Errorf("you must be a moderator of that realm then can create channel related to it") @@ -120,7 +120,7 @@ func editChannel(c *fiber.Ctx) error { tx := database.C.Where(&models.Channel{BaseModel: models.BaseModel{ID: uint(id)}}) if val, ok := c.Locals("realm").(models.Realm); ok { - if info, err := services.GetRealmMember(val.ID, user.ExternalID); err != nil { + if info, err := services.GetRealmMember(val.ExternalID, user.ExternalID); err != nil { return fmt.Errorf("you must be a part of that realm then can edit channel related to it") } else if info.GetPowerLevel() < 50 { return fmt.Errorf("you must be a moderator of that realm then can edit channel related to it") @@ -151,7 +151,7 @@ func deleteChannel(c *fiber.Ctx) error { tx := database.C.Where(&models.Channel{BaseModel: models.BaseModel{ID: uint(id)}}) if val, ok := c.Locals("realm").(models.Realm); ok { - if info, err := services.GetRealmMember(val.ID, user.ExternalID); err != nil { + if info, err := services.GetRealmMember(val.ExternalID, user.ExternalID); err != nil { return fmt.Errorf("you must be a part of that realm then can delete channel related to it") } else if info.GetPowerLevel() < 50 { return fmt.Errorf("you must be a moderator of that realm then can delete channel related to it")