基于事件的消息构成 #1

Merged
LittleSheep merged 3 commits from refactor/event-based-messages into master 2024-06-27 20:36:37 +00:00
Showing only changes of commit ba974b13be - Show all commits

View File

@ -28,6 +28,10 @@ func newMessageEvent(c *fiber.Ctx) error {
return fiber.NewError(fiber.StatusBadRequest, "message uuid was not valid") return fiber.NewError(fiber.StatusBadRequest, "message uuid was not valid")
} }
if len(data.Body.Text) == 0 && len(data.Body.Attachments) == 0 {
return fiber.NewError(fiber.StatusBadRequest, "you cannot send an empty message")
}
var err error var err error
var channel models.Channel var channel models.Channel
var member models.ChannelMember var member models.ChannelMember
@ -84,6 +88,10 @@ func editMessageEvent(c *fiber.Ctx) error {
return err return err
} }
if len(data.Body.Text) == 0 && len(data.Body.Attachments) == 0 {
return fiber.NewError(fiber.StatusBadRequest, "you cannot send an empty message")
}
var err error var err error
var channel models.Channel var channel models.Channel
var member models.ChannelMember var member models.ChannelMember