diff --git a/DysonNetwork.Sphere/Account/NotificationService.cs b/DysonNetwork.Sphere/Account/NotificationService.cs index ae795f2..a58b22c 100644 --- a/DysonNetwork.Sphere/Account/NotificationService.cs +++ b/DysonNetwork.Sphere/Account/NotificationService.cs @@ -67,6 +67,7 @@ public class NotificationService( string? subtitle = null, string? content = null, Dictionary? meta = null, + string? actionUri = null, bool isSilent = false, bool save = true ) @@ -74,6 +75,9 @@ public class NotificationService( if (title is null && subtitle is null && content is null) throw new ArgumentException("Unable to send notification that completely empty."); + meta ??= new Dictionary(); + if (actionUri is not null) meta["action_uri"] = actionUri; + var notification = new Notification { Topic = topic, diff --git a/DysonNetwork.Sphere/Chat/ChatRoomController.cs b/DysonNetwork.Sphere/Chat/ChatRoomController.cs index f2ff5a9..b1b7694 100644 --- a/DysonNetwork.Sphere/Chat/ChatRoomController.cs +++ b/DysonNetwork.Sphere/Chat/ChatRoomController.cs @@ -799,6 +799,6 @@ public class ChatRoomController( : localizer["ChatInviteBody", member.ChatRoom.Name ?? "Unnamed"]; AccountService.SetCultureInfo(member.Account); - await nty.SendNotification(member.Account, "invites.chats", title, null, body); + await nty.SendNotification(member.Account, "invites.chats", title, null, body, actionUri: "/chat"); } } \ No newline at end of file diff --git a/DysonNetwork.Sphere/Post/PostService.cs b/DysonNetwork.Sphere/Post/PostService.cs index 030d1f2..71bc2c5 100644 --- a/DysonNetwork.Sphere/Post/PostService.cs +++ b/DysonNetwork.Sphere/Post/PostService.cs @@ -151,7 +151,8 @@ public class PostService( null, string.IsNullOrWhiteSpace(post.Title) ? localizer["PostReplyBody", sender.Nick, content] - : localizer["PostReplyContentBody", sender.Nick, post.Title, content] + : localizer["PostReplyContentBody", sender.Nick, post.Title, content], + actionUri: $"/posts/{post.Id}" ); } } @@ -324,7 +325,8 @@ public class PostService( string.IsNullOrWhiteSpace(post.Title) ? localizer["PostReactBody", sender.Nick, reaction.Symbol] : localizer["PostReactContentBody", sender.Nick, reaction.Symbol, - post.Title] + post.Title], + actionUri: $"/posts/{post.Id}" ); } } diff --git a/DysonNetwork.Sphere/Publisher/PublisherSubscriptionService.cs b/DysonNetwork.Sphere/Publisher/PublisherSubscriptionService.cs index c1743cc..7b6867d 100644 --- a/DysonNetwork.Sphere/Publisher/PublisherSubscriptionService.cs +++ b/DysonNetwork.Sphere/Publisher/PublisherSubscriptionService.cs @@ -76,7 +76,8 @@ public class PublisherSubscriptionService( localizer["PostSubscriptionTitle", post.Publisher.Name, title], null, message, - data + data, + actionUri: $"/posts/{post.Id}" ); notifiedCount++; diff --git a/DysonNetwork.Sphere/Realm/RealmService.cs b/DysonNetwork.Sphere/Realm/RealmService.cs index 5b0cd3e..605d23d 100644 --- a/DysonNetwork.Sphere/Realm/RealmService.cs +++ b/DysonNetwork.Sphere/Realm/RealmService.cs @@ -15,7 +15,8 @@ public class RealmService(AppDatabase db, NotificationService nty, IStringLocali "invites.realms", localizer["RealmInviteTitle"], null, - localizer["RealmInviteBody", member.Realm.Name] + localizer["RealmInviteBody", member.Realm.Name], + actionUri: "/realms" ); }