From b3fe2c2163a3a97b5a508b9461fbbe8d372eae58 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Sat, 13 Jul 2024 11:13:01 +0800 Subject: [PATCH] :wheelchair: Optimize end call logic --- pkg/internal/server/api/calls_api.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/internal/server/api/calls_api.go b/pkg/internal/server/api/calls_api.go index 8b50565..a5e508f 100644 --- a/pkg/internal/server/api/calls_api.go +++ b/pkg/internal/server/api/calls_api.go @@ -111,8 +111,8 @@ func endCall(c *fiber.Ctx) error { call, err := services.GetOngoingCall(channel) if err != nil { return fiber.NewError(fiber.StatusNotFound, err.Error()) - } else if call.FounderID != user.ID && channel.AccountID != user.ID { - return fiber.NewError(fiber.StatusBadRequest, "only call founder or channel owner can end this call") + } else if call.FounderID != user.ID && membership.PowerLevel < 100 { + return fiber.NewError(fiber.StatusBadRequest, "only call founder or channel admin can end this call") } if call, err := services.EndCall(call); err != nil {