From ca57faa7c3a105f84c77ebca84648127e630ee5e Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Sun, 1 Jun 2025 01:47:30 +0800 Subject: [PATCH] :bug: Fix chat notification subject --- DysonNetwork.Sphere/Account/NotificationService.cs | 2 +- DysonNetwork.Sphere/Chat/ChatService.cs | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/DysonNetwork.Sphere/Account/NotificationService.cs b/DysonNetwork.Sphere/Account/NotificationService.cs index 46a9e9e..93135fb 100644 --- a/DysonNetwork.Sphere/Account/NotificationService.cs +++ b/DysonNetwork.Sphere/Account/NotificationService.cs @@ -215,7 +215,7 @@ public class NotificationService( ["meta"] = notification.Meta ?? new Dictionary(), }, ["mutable_content"] = true, - ["priority"] = notification.Priority >= 10 ? "high" : "normal", + ["priority"] = notification.Priority >= 5 ? "high" : "normal", }; if (!string.IsNullOrWhiteSpace(notification.Title)) diff --git a/DysonNetwork.Sphere/Chat/ChatService.cs b/DysonNetwork.Sphere/Chat/ChatService.cs index 6331678..a9c54df 100644 --- a/DysonNetwork.Sphere/Chat/ChatService.cs +++ b/DysonNetwork.Sphere/Chat/ChatService.cs @@ -65,7 +65,8 @@ public class ChatService( var scopedNty = scope.ServiceProvider.GetRequiredService(); var scopedCrs = scope.ServiceProvider.GetRequiredService(); - var roomSubject = room.Realm is not null ? $"{room.Name}, {room.Realm.Name}" : room.Name; + var roomSubject = room is { Type: ChatRoomType.DirectMessage, Name: null } ? "DM" : + room.Realm is not null ? $"{room.Name}, {room.Realm.Name}" : room.Name; var members = await scopedCrs.ListRoomMembers(room.Id); @@ -89,7 +90,7 @@ public class ChatService( var notification = new Notification { Topic = "messages.new", - Title = $"{sender.Nick ?? sender.Account.Nick ?? "Unknown"} ({roomSubject})", + Title = $"{sender.Nick ?? sender.Account.Nick} ({roomSubject})", Content = !string.IsNullOrEmpty(message.Content) ? message.Content[..Math.Min(message.Content.Length, 100)] : "",