diff --git a/src/BE/Controllers/Chats/Chats/ChatController.cs b/src/BE/Controllers/Chats/Chats/ChatController.cs index e93f8af5..45af307e 100644 --- a/src/BE/Controllers/Chats/Chats/ChatController.cs +++ b/src/BE/Controllers/Chats/Chats/ChatController.cs @@ -190,7 +190,7 @@ public async Task ChatPrivate( MessageLiteDto[] systemMessages = GetSystemMessages(chat, req.Spans, existingMessages, isEmptyChat); // ensure chat.ChatSpan contains all span ids that in request, otherwise return error - if (req.Spans!.Any(x => !chat.ChatSpans.Any(y => y.SpanId == x.Id))) + if (req.Spans.Any(x => !chat.ChatSpans.Any(y => y.SpanId == x.Id))) { return BadRequest("Invalid span id"); } diff --git a/src/BE/Controllers/Chats/Chats/ChatSpanController.cs b/src/BE/Controllers/Chats/Chats/ChatSpanController.cs index 2cf1fa79..fe5f68de 100644 --- a/src/BE/Controllers/Chats/Chats/ChatSpanController.cs +++ b/src/BE/Controllers/Chats/Chats/ChatSpanController.cs @@ -139,12 +139,6 @@ public async Task DeleteChatSpan(string encryptedChatId, byte spa return NotFound(); } - bool hasMessages = await db.Messages.AnyAsync(x => x.ChatId == chatId && x.SpanId == spanId, cancellationToken); - if (hasMessages) - { - return BadRequest("Cannot delete span with messages"); - } - db.ChatSpans.Remove(span); await db.SaveChangesAsync(cancellationToken); return NoContent();