From 9e25e7e6cc6a75d409db278494624e0198a9671f Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Sun, 5 May 2024 21:18:53 +0800 Subject: [PATCH] :bug: Fix provide the cloned realm id to remote --- pkg/server/channels_api.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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")