🐛 Fix provide the cloned realm id to remote
This commit is contained in:
parent
e443448a94
commit
9e25e7e6cc
@ -79,7 +79,7 @@ func createChannel(c *fiber.Ctx) error {
|
|||||||
|
|
||||||
var realm *models.Realm
|
var realm *models.Realm
|
||||||
if val, ok := c.Locals("realm").(models.Realm); ok {
|
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")
|
return fmt.Errorf("you must be a part of that realm then can create channel related to it")
|
||||||
} else if info.GetPowerLevel() < 50 {
|
} else if info.GetPowerLevel() < 50 {
|
||||||
return fmt.Errorf("you must be a moderator of that realm then can create channel related to it")
|
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)}})
|
tx := database.C.Where(&models.Channel{BaseModel: models.BaseModel{ID: uint(id)}})
|
||||||
|
|
||||||
if val, ok := c.Locals("realm").(models.Realm); ok {
|
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")
|
return fmt.Errorf("you must be a part of that realm then can edit channel related to it")
|
||||||
} else if info.GetPowerLevel() < 50 {
|
} else if info.GetPowerLevel() < 50 {
|
||||||
return fmt.Errorf("you must be a moderator of that realm then can edit channel related to it")
|
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)}})
|
tx := database.C.Where(&models.Channel{BaseModel: models.BaseModel{ID: uint(id)}})
|
||||||
|
|
||||||
if val, ok := c.Locals("realm").(models.Realm); ok {
|
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")
|
return fmt.Errorf("you must be a part of that realm then can delete channel related to it")
|
||||||
} else if info.GetPowerLevel() < 50 {
|
} else if info.GetPowerLevel() < 50 {
|
||||||
return fmt.Errorf("you must be a moderator of that realm then can delete channel related to it")
|
return fmt.Errorf("you must be a moderator of that realm then can delete channel related to it")
|
||||||
|
Loading…
Reference in New Issue
Block a user