Improve notification management (#561)
* Don't notify for comment when mentioned fix #505 * Don't save notification for remote users fix #472
This commit is contained in:
@@ -4,7 +4,7 @@ use diesel::{self, ExpressionMethods, QueryDsl, RunQueryDsl};
|
||||
|
||||
use notifications::*;
|
||||
use plume_common::activity_pub::{
|
||||
inbox::{AsObject, FromId},
|
||||
inbox::{AsActor, AsObject, FromId},
|
||||
Id, IntoId, PUBLIC_VISIBILITY,
|
||||
};
|
||||
use posts::Post;
|
||||
@@ -54,14 +54,16 @@ impl Like {
|
||||
pub fn notify(&self, conn: &Connection) -> Result<()> {
|
||||
let post = Post::get(conn, self.post_id)?;
|
||||
for author in post.get_authors(conn)? {
|
||||
Notification::insert(
|
||||
conn,
|
||||
NewNotification {
|
||||
kind: notification_kind::LIKE.to_string(),
|
||||
object_id: self.id,
|
||||
user_id: author.id,
|
||||
},
|
||||
)?;
|
||||
if author.is_local() {
|
||||
Notification::insert(
|
||||
conn,
|
||||
NewNotification {
|
||||
kind: notification_kind::LIKE.to_string(),
|
||||
object_id: self.id,
|
||||
user_id: author.id,
|
||||
},
|
||||
)?;
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user