🐛 Fix chat notification subject
This commit is contained in:
parent
7040b236e9
commit
ca57faa7c3
@ -215,7 +215,7 @@ public class NotificationService(
|
|||||||
["meta"] = notification.Meta ?? new Dictionary<string, object>(),
|
["meta"] = notification.Meta ?? new Dictionary<string, object>(),
|
||||||
},
|
},
|
||||||
["mutable_content"] = true,
|
["mutable_content"] = true,
|
||||||
["priority"] = notification.Priority >= 10 ? "high" : "normal",
|
["priority"] = notification.Priority >= 5 ? "high" : "normal",
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(notification.Title))
|
if (!string.IsNullOrWhiteSpace(notification.Title))
|
||||||
|
@ -65,7 +65,8 @@ public class ChatService(
|
|||||||
var scopedNty = scope.ServiceProvider.GetRequiredService<NotificationService>();
|
var scopedNty = scope.ServiceProvider.GetRequiredService<NotificationService>();
|
||||||
var scopedCrs = scope.ServiceProvider.GetRequiredService<ChatRoomService>();
|
var scopedCrs = scope.ServiceProvider.GetRequiredService<ChatRoomService>();
|
||||||
|
|
||||||
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);
|
var members = await scopedCrs.ListRoomMembers(room.Id);
|
||||||
|
|
||||||
@ -89,7 +90,7 @@ public class ChatService(
|
|||||||
var notification = new Notification
|
var notification = new Notification
|
||||||
{
|
{
|
||||||
Topic = "messages.new",
|
Topic = "messages.new",
|
||||||
Title = $"{sender.Nick ?? sender.Account.Nick ?? "Unknown"} ({roomSubject})",
|
Title = $"{sender.Nick ?? sender.Account.Nick} ({roomSubject})",
|
||||||
Content = !string.IsNullOrEmpty(message.Content)
|
Content = !string.IsNullOrEmpty(message.Content)
|
||||||
? message.Content[..Math.Min(message.Content.Length, 100)]
|
? message.Content[..Math.Min(message.Content.Length, 100)]
|
||||||
: "<no content>",
|
: "<no content>",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user