mirror of
https://git.joinplu.me/Plume/Plume.git
synced 2024-11-26 21:41:04 +00:00
Send a notification when one of your article is reshared
Fixes #14 Fixes #19
This commit is contained in:
parent
0b098e539f
commit
daf9120fba
1 changed files with 10 additions and 0 deletions
|
@ -444,6 +444,16 @@ impl Inbox for User {
|
||||||
|
|
||||||
// Notifications
|
// Notifications
|
||||||
match act["type"].as_str().unwrap() {
|
match act["type"].as_str().unwrap() {
|
||||||
|
"Announce" => {
|
||||||
|
let actor = User::from_url(conn, act["actor"].as_str().unwrap().to_string()).unwrap();
|
||||||
|
let post = Post::find_by_ap_url(conn, act["object"].as_str().unwrap().to_string()).unwrap();
|
||||||
|
Notification::insert(conn, NewNotification {
|
||||||
|
title: format!("{} reshared your article", actor.display_name.clone()),
|
||||||
|
content: Some(post.title),
|
||||||
|
link: Some(post.ap_url),
|
||||||
|
user_id: self.id
|
||||||
|
});
|
||||||
|
},
|
||||||
"Follow" => {
|
"Follow" => {
|
||||||
let follower = User::from_url(conn, act["actor"].as_str().unwrap().to_string()).unwrap();
|
let follower = User::from_url(conn, act["actor"].as_str().unwrap().to_string()).unwrap();
|
||||||
Notification::insert(conn, NewNotification {
|
Notification::insert(conn, NewNotification {
|
||||||
|
|
Loading…
Reference in a new issue