Make notifications translatable
This commit is contained in:
@@ -152,7 +152,8 @@ impl Notify<Note> for Comment {
|
||||
for author in comment.clone().get_post(conn).get_authors(conn) {
|
||||
let comment = comment.clone();
|
||||
Notification::insert(conn, NewNotification {
|
||||
title: format!("{} commented your article", comment.get_author(conn).display_name.clone()),
|
||||
title: "{{ data }} commented your article".to_string(),
|
||||
data: Some(comment.get_author(conn).display_name.clone()),
|
||||
content: Some(comment.get_post(conn).title),
|
||||
link: comment.ap_url,
|
||||
user_id: author.id
|
||||
|
||||
@@ -78,7 +78,8 @@ impl Notify<FollowAct> for Follow {
|
||||
fn notify(conn: &PgConnection, follow: FollowAct, actor: Id) {
|
||||
let follower = User::from_url(conn, actor.into()).unwrap();
|
||||
Notification::insert(conn, NewNotification {
|
||||
title: format!("{} started following you", follower.display_name.clone()),
|
||||
title: "{{ data }} started following you".to_string(),
|
||||
data: Some(follower.display_name.clone()),
|
||||
content: None,
|
||||
link: Some(follower.ap_url),
|
||||
user_id: User::from_url(conn, follow.follow_props.object_link::<Id>().unwrap().into()).unwrap().id
|
||||
|
||||
+2
-1
@@ -118,7 +118,8 @@ impl Notify<activity::Like> for Like {
|
||||
for author in post.get_authors(conn) {
|
||||
let post = post.clone();
|
||||
Notification::insert(conn, NewNotification {
|
||||
title: format!("{} liked your article", liker.display_name.clone()),
|
||||
title: "{{ data }} liked your article".to_string(),
|
||||
data: Some(liker.display_name.clone()),
|
||||
content: Some(post.title),
|
||||
link: Some(post.ap_url),
|
||||
user_id: author.id
|
||||
|
||||
@@ -11,7 +11,8 @@ pub struct Notification {
|
||||
pub content: Option<String>,
|
||||
pub link: Option<String>,
|
||||
pub user_id: i32,
|
||||
pub creation_date: NaiveDateTime
|
||||
pub creation_date: NaiveDateTime,
|
||||
pub data: Option<String>
|
||||
}
|
||||
|
||||
#[derive(Insertable)]
|
||||
@@ -20,7 +21,8 @@ pub struct NewNotification {
|
||||
pub title: String,
|
||||
pub content: Option<String>,
|
||||
pub link: Option<String>,
|
||||
pub user_id: i32
|
||||
pub user_id: i32,
|
||||
pub data: Option<String>
|
||||
}
|
||||
|
||||
impl Notification {
|
||||
|
||||
@@ -120,7 +120,8 @@ impl Notify<Announce> for Reshare {
|
||||
for author in post.get_authors(conn) {
|
||||
let post = post.clone();
|
||||
Notification::insert(conn, NewNotification {
|
||||
title: format!("{} reshared your article", actor.display_name.clone()),
|
||||
title: "{{ data }} reshared your article".to_string(),
|
||||
data: Some(actor.display_name.clone()),
|
||||
content: Some(post.title),
|
||||
link: Some(post.ap_url),
|
||||
user_id: author.id
|
||||
|
||||
@@ -74,6 +74,7 @@ table! {
|
||||
link -> Nullable<Varchar>,
|
||||
user_id -> Int4,
|
||||
creation_date -> Timestamp,
|
||||
data -> Nullable<Varchar>,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user