Merge pull request 'Fix notification page error' (#981) from fix-notification-page into main

Reviewed-on: https://git.joinplu.me/Plume/Plume/pulls/981
This commit is contained in:
KitaitiMakoto 2022-01-03 14:29:43 +00:00
commit b33b19849c
2 changed files with 7 additions and 1 deletions

View File

@ -4,6 +4,10 @@
## [Unreleased] - ReleaseDate
### Fiexed
- Fix a bug that notification page doesn't show
## [[0.7.0]] - 2022-01-02
### Added

View File

@ -100,7 +100,9 @@ macro_rules! render {
}
pub fn translate_notification(ctx: BaseContext<'_>, notif: Notification) -> String {
let name = notif.get_actor(ctx.0).unwrap().name();
let name = notif
.get_actor(ctx.0)
.map_or_else(|_| i18n!(ctx.1, "Someone"), |user| user.name());
match notif.kind.as_ref() {
notification_kind::COMMENT => i18n!(ctx.1, "{0} commented on your article."; &name),
notification_kind::FOLLOW => i18n!(ctx.1, "{0} is subscribed to you."; &name),