mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-27 20:01:06 +00:00
fix comment notifications
This commit is contained in:
parent
c34cc46c2d
commit
f3aba6da92
4 changed files with 17 additions and 19 deletions
|
@ -178,7 +178,7 @@ impl ApubObjectType for Comment {
|
||||||
.set_actor_xsd_any_uri(creator.actor_id.to_owned())?
|
.set_actor_xsd_any_uri(creator.actor_id.to_owned())?
|
||||||
.set_object_base_box(note)?;
|
.set_object_base_box(note)?;
|
||||||
|
|
||||||
Comment::send_comment_activity(&creator, &conn, &community, create)?;
|
Comment::send_comment_activity(&creator, &conn, &community, maa.inboxes,create)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -203,7 +203,7 @@ impl ApubObjectType for Comment {
|
||||||
.set_actor_xsd_any_uri(creator.actor_id.to_owned())?
|
.set_actor_xsd_any_uri(creator.actor_id.to_owned())?
|
||||||
.set_object_base_box(note)?;
|
.set_object_base_box(note)?;
|
||||||
|
|
||||||
Comment::send_comment_activity(&creator, &conn, &community, update)?;
|
Comment::send_comment_activity(&creator, &conn, &community, maa.inboxes, update)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -225,7 +225,7 @@ impl ApubObjectType for Comment {
|
||||||
.set_actor_xsd_any_uri(creator.actor_id.to_owned())?
|
.set_actor_xsd_any_uri(creator.actor_id.to_owned())?
|
||||||
.set_object_base_box(note)?;
|
.set_object_base_box(note)?;
|
||||||
|
|
||||||
Comment::send_comment_activity(&creator, &conn, &community, delete)?;
|
Comment::send_comment_activity(&creator, &conn, &community,vec!(community.get_shared_inbox_url()), delete)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -265,7 +265,7 @@ impl ApubObjectType for Comment {
|
||||||
.set_actor_xsd_any_uri(creator.actor_id.to_owned())?
|
.set_actor_xsd_any_uri(creator.actor_id.to_owned())?
|
||||||
.set_object_base_box(delete)?;
|
.set_object_base_box(delete)?;
|
||||||
|
|
||||||
Comment::send_comment_activity(&creator, &conn, &community, undo)?;
|
Comment::send_comment_activity(&creator, &conn, &community, vec!(community.get_shared_inbox_url()),undo)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -287,7 +287,7 @@ impl ApubObjectType for Comment {
|
||||||
.set_actor_xsd_any_uri(mod_.actor_id.to_owned())?
|
.set_actor_xsd_any_uri(mod_.actor_id.to_owned())?
|
||||||
.set_object_base_box(note)?;
|
.set_object_base_box(note)?;
|
||||||
|
|
||||||
Comment::send_comment_activity(&mod_, &conn, &community, remove)?;
|
Comment::send_comment_activity(&mod_, &conn, &community, vec!(community.get_shared_inbox_url()),remove)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -326,7 +326,7 @@ impl ApubObjectType for Comment {
|
||||||
.set_actor_xsd_any_uri(mod_.actor_id.to_owned())?
|
.set_actor_xsd_any_uri(mod_.actor_id.to_owned())?
|
||||||
.set_object_base_box(remove)?;
|
.set_object_base_box(remove)?;
|
||||||
|
|
||||||
Comment::send_comment_activity(&mod_, &conn, &community, undo)?;
|
Comment::send_comment_activity(&mod_, &conn, &community, vec!(community.get_shared_inbox_url()),undo)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -349,7 +349,7 @@ impl ApubLikeableType for Comment {
|
||||||
.set_actor_xsd_any_uri(creator.actor_id.to_owned())?
|
.set_actor_xsd_any_uri(creator.actor_id.to_owned())?
|
||||||
.set_object_base_box(note)?;
|
.set_object_base_box(note)?;
|
||||||
|
|
||||||
Comment::send_comment_activity(&creator, &conn, &community, like)?;
|
Comment::send_comment_activity(&creator, &conn, &community, vec!(community.get_shared_inbox_url()),like)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -370,7 +370,7 @@ impl ApubLikeableType for Comment {
|
||||||
.set_actor_xsd_any_uri(creator.actor_id.to_owned())?
|
.set_actor_xsd_any_uri(creator.actor_id.to_owned())?
|
||||||
.set_object_base_box(note)?;
|
.set_object_base_box(note)?;
|
||||||
|
|
||||||
Comment::send_comment_activity(&creator, &conn, &community, dislike)?;
|
Comment::send_comment_activity(&creator, &conn, &community, vec!(community.get_shared_inbox_url()),dislike)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -407,7 +407,7 @@ impl ApubLikeableType for Comment {
|
||||||
.set_actor_xsd_any_uri(creator.actor_id.to_owned())?
|
.set_actor_xsd_any_uri(creator.actor_id.to_owned())?
|
||||||
.set_object_base_box(like)?;
|
.set_object_base_box(like)?;
|
||||||
|
|
||||||
Comment::send_comment_activity(&creator, &conn, &community, undo)?;
|
Comment::send_comment_activity(&creator, &conn, &community, vec!(community.get_shared_inbox_url()), undo)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -455,7 +455,7 @@ fn collect_non_local_mentions_and_addresses(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut inboxes = community.get_follower_inboxes(&conn)?;
|
let mut inboxes = vec!(community.get_shared_inbox_url());
|
||||||
inboxes.extend(mention_inboxes);
|
inboxes.extend(mention_inboxes);
|
||||||
inboxes = inboxes.into_iter().unique().collect();
|
inboxes = inboxes.into_iter().unique().collect();
|
||||||
|
|
||||||
|
@ -471,6 +471,7 @@ impl Comment {
|
||||||
creator: &User_,
|
creator: &User_,
|
||||||
conn: &PgConnection,
|
conn: &PgConnection,
|
||||||
community: &Community,
|
community: &Community,
|
||||||
|
to: Vec<String>,
|
||||||
activity: A,
|
activity: A,
|
||||||
) -> Result<(), Error>
|
) -> Result<(), Error>
|
||||||
where
|
where
|
||||||
|
@ -480,9 +481,9 @@ impl Comment {
|
||||||
|
|
||||||
// if this is a local community, we need to do an announce from the community instead
|
// if this is a local community, we need to do an announce from the community instead
|
||||||
if community.local {
|
if community.local {
|
||||||
Community::do_announce(activity, &community.actor_id, &creator.actor_id, conn, true)?;
|
Community::do_announce(activity, &community, &creator.actor_id, conn, true)?;
|
||||||
} else {
|
} else {
|
||||||
send_activity(&activity, creator, vec![community.get_shared_inbox_url()])?;
|
send_activity(&activity, creator, to)?;
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
@ -384,8 +384,7 @@ pub async fn get_apub_community_followers(
|
||||||
impl Community {
|
impl Community {
|
||||||
pub fn do_announce<A>(
|
pub fn do_announce<A>(
|
||||||
activity: A,
|
activity: A,
|
||||||
// TODO: maybe pass in the community object
|
community: &Community,
|
||||||
community_uri: &str,
|
|
||||||
sender: &str,
|
sender: &str,
|
||||||
conn: &PgConnection,
|
conn: &PgConnection,
|
||||||
is_local_activity: bool,
|
is_local_activity: bool,
|
||||||
|
@ -393,8 +392,6 @@ impl Community {
|
||||||
where
|
where
|
||||||
A: Activity + Base + Serialize + Debug,
|
A: Activity + Base + Serialize + Debug,
|
||||||
{
|
{
|
||||||
let community = Community::read_from_actor_id(conn, &community_uri)?;
|
|
||||||
|
|
||||||
insert_activity(&conn, -1, &activity, is_local_activity)?;
|
insert_activity(&conn, -1, &activity, is_local_activity)?;
|
||||||
|
|
||||||
let mut announce = Announce::default();
|
let mut announce = Announce::default();
|
||||||
|
@ -417,7 +414,7 @@ impl Community {
|
||||||
// this seems to be the "easiest" stable alternative for remove_item()
|
// this seems to be the "easiest" stable alternative for remove_item()
|
||||||
to.retain(|x| *x != sending_user.get_shared_inbox_url());
|
to.retain(|x| *x != sending_user.get_shared_inbox_url());
|
||||||
|
|
||||||
send_activity(&announce, &community, to)?;
|
send_activity(&announce, community, to)?;
|
||||||
|
|
||||||
Ok(HttpResponse::Ok().finish())
|
Ok(HttpResponse::Ok().finish())
|
||||||
}
|
}
|
||||||
|
|
|
@ -479,7 +479,7 @@ impl Post {
|
||||||
|
|
||||||
// if this is a local community, we need to do an announce from the community instead
|
// if this is a local community, we need to do an announce from the community instead
|
||||||
if community.local {
|
if community.local {
|
||||||
Community::do_announce(activity, &community.actor_id, &creator.actor_id, conn, true)?;
|
Community::do_announce(activity, &community, &creator.actor_id, conn, true)?;
|
||||||
} else {
|
} else {
|
||||||
send_activity(&activity, creator, vec![community.get_shared_inbox_url()])?;
|
send_activity(&activity, creator, vec![community.get_shared_inbox_url()])?;
|
||||||
}
|
}
|
||||||
|
|
|
@ -220,7 +220,7 @@ where
|
||||||
if !community.local {
|
if !community.local {
|
||||||
// ignore this object
|
// ignore this object
|
||||||
}
|
}
|
||||||
Community::do_announce(activity, &community_uri, sender, conn, false)
|
Community::do_announce(activity, &community, sender, conn, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn receive_announce(
|
fn receive_announce(
|
||||||
|
|
Loading…
Reference in a new issue