🐛 Fixes on notify level

This commit is contained in:
LittleSheep 2025-06-10 00:39:00 +08:00
parent 922bf110ac
commit 2fb29284fb

View File

@ -520,7 +520,7 @@ public class ChatRoomController(
.FirstOrDefaultAsync(); .FirstOrDefaultAsync();
if (member is null) return NotFound(); if (member is null) return NotFound();
member.JoinedAt = NodaTime.Instant.FromDateTimeUtc(DateTime.UtcNow); member.JoinedAt = Instant.FromDateTimeUtc(DateTime.UtcNow);
db.Update(member); db.Update(member);
await db.SaveChangesAsync(); await db.SaveChangesAsync();
_ = crs.PurgeRoomMembersCache(roomId); _ = crs.PurgeRoomMembersCache(roomId);
@ -563,7 +563,6 @@ public class ChatRoomController(
[Authorize] [Authorize]
public async Task<ActionResult<ChatMember>> UpdateChatMemberNotify( public async Task<ActionResult<ChatMember>> UpdateChatMemberNotify(
Guid roomId, Guid roomId,
Guid memberId,
[FromBody] ChatMemberNotifyRequest request [FromBody] ChatMemberNotifyRequest request
) )
{ {
@ -575,7 +574,7 @@ public class ChatRoomController(
if (chatRoom is null) return NotFound(); if (chatRoom is null) return NotFound();
var targetMember = await db.ChatMembers var targetMember = await db.ChatMembers
.Where(m => m.AccountId == memberId && m.ChatRoomId == roomId) .Where(m => m.AccountId == currentUser.Id && m.ChatRoomId == roomId)
.FirstOrDefaultAsync(); .FirstOrDefaultAsync();
if (targetMember is null) return BadRequest("You have not joined this chat room."); if (targetMember is null) return BadRequest("You have not joined this chat room.");
if (request.NotifyLevel is not null) if (request.NotifyLevel is not null)