🐛 Fix some issues in moving realm service

This commit is contained in:
2025-10-22 21:56:50 +08:00
parent d6c37784e1
commit ff03584518
6 changed files with 120 additions and 12 deletions

View File

@@ -35,9 +35,12 @@ public class ChatRoomController(
{
var chatRoom = await db.ChatRooms
.Where(c => c.Id == id)
.Include(e => e.Realm)
.FirstOrDefaultAsync();
if (chatRoom is null) return NotFound();
if (chatRoom.RealmId != null)
chatRoom.Realm = await rs.GetRealm(chatRoom.RealmId.Value.ToString());
if (chatRoom.Type != ChatRoomType.DirectMessage) return Ok(chatRoom);
if (HttpContext.Items["CurrentUser"] is Account currentUser)