✨ Notification action URIs
This commit is contained in:
parent
e7942fc687
commit
c8b1c1ba55
@ -67,6 +67,7 @@ public class NotificationService(
|
|||||||
string? subtitle = null,
|
string? subtitle = null,
|
||||||
string? content = null,
|
string? content = null,
|
||||||
Dictionary<string, object>? meta = null,
|
Dictionary<string, object>? meta = null,
|
||||||
|
string? actionUri = null,
|
||||||
bool isSilent = false,
|
bool isSilent = false,
|
||||||
bool save = true
|
bool save = true
|
||||||
)
|
)
|
||||||
@ -74,6 +75,9 @@ public class NotificationService(
|
|||||||
if (title is null && subtitle is null && content is null)
|
if (title is null && subtitle is null && content is null)
|
||||||
throw new ArgumentException("Unable to send notification that completely empty.");
|
throw new ArgumentException("Unable to send notification that completely empty.");
|
||||||
|
|
||||||
|
meta ??= new Dictionary<string, object>();
|
||||||
|
if (actionUri is not null) meta["action_uri"] = actionUri;
|
||||||
|
|
||||||
var notification = new Notification
|
var notification = new Notification
|
||||||
{
|
{
|
||||||
Topic = topic,
|
Topic = topic,
|
||||||
|
@ -799,6 +799,6 @@ public class ChatRoomController(
|
|||||||
: localizer["ChatInviteBody", member.ChatRoom.Name ?? "Unnamed"];
|
: localizer["ChatInviteBody", member.ChatRoom.Name ?? "Unnamed"];
|
||||||
|
|
||||||
AccountService.SetCultureInfo(member.Account);
|
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");
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -151,7 +151,8 @@ public class PostService(
|
|||||||
null,
|
null,
|
||||||
string.IsNullOrWhiteSpace(post.Title)
|
string.IsNullOrWhiteSpace(post.Title)
|
||||||
? localizer["PostReplyBody", sender.Nick, content]
|
? 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)
|
string.IsNullOrWhiteSpace(post.Title)
|
||||||
? localizer["PostReactBody", sender.Nick, reaction.Symbol]
|
? localizer["PostReactBody", sender.Nick, reaction.Symbol]
|
||||||
: localizer["PostReactContentBody", sender.Nick, reaction.Symbol,
|
: localizer["PostReactContentBody", sender.Nick, reaction.Symbol,
|
||||||
post.Title]
|
post.Title],
|
||||||
|
actionUri: $"/posts/{post.Id}"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,8 @@ public class PublisherSubscriptionService(
|
|||||||
localizer["PostSubscriptionTitle", post.Publisher.Name, title],
|
localizer["PostSubscriptionTitle", post.Publisher.Name, title],
|
||||||
null,
|
null,
|
||||||
message,
|
message,
|
||||||
data
|
data,
|
||||||
|
actionUri: $"/posts/{post.Id}"
|
||||||
);
|
);
|
||||||
|
|
||||||
notifiedCount++;
|
notifiedCount++;
|
||||||
|
@ -15,7 +15,8 @@ public class RealmService(AppDatabase db, NotificationService nty, IStringLocali
|
|||||||
"invites.realms",
|
"invites.realms",
|
||||||
localizer["RealmInviteTitle"],
|
localizer["RealmInviteTitle"],
|
||||||
null,
|
null,
|
||||||
localizer["RealmInviteBody", member.Realm.Name]
|
localizer["RealmInviteBody", member.Realm.Name],
|
||||||
|
actionUri: "/realms"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user