Federate votes as private (#2501)

enable-lto
Nutomic 2022-10-18 03:13:18 +00:00 committed by GitHub
parent 74bc1198ce
commit aaaea2006c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 3 additions and 28 deletions

View File

@ -1,9 +1,6 @@
{ {
"actor": "http://enterprise.lemmy.ml/u/lemmy_beta", "actor": "http://enterprise.lemmy.ml/u/lemmy_beta",
"object": "http://ds9.lemmy.ml/post/1", "object": "http://ds9.lemmy.ml/post/1",
"cc": [
"https://www.w3.org/ns/activitystreams#Public"
],
"type": "Dislike", "type": "Dislike",
"id": "http://enterprise.lemmy.ml/activities/dislike/64d40d40-a829-43a5-8247-1fb595b3ca1c" "id": "http://enterprise.lemmy.ml/activities/dislike/64d40d40-a829-43a5-8247-1fb595b3ca1c"
} }

View File

@ -1,9 +1,6 @@
{ {
"actor": "http://ds9.lemmy.ml/u/lemmy_alpha", "actor": "http://ds9.lemmy.ml/u/lemmy_alpha",
"object": "http://ds9.lemmy.ml/comment/1", "object": "http://ds9.lemmy.ml/comment/1",
"cc": [
"https://www.w3.org/ns/activitystreams#Public"
],
"type": "Like", "type": "Like",
"id": "http://ds9.lemmy.ml/activities/like/fd61d070-7382-46a9-b2b7-6bb253732877" "id": "http://ds9.lemmy.ml/activities/like/fd61d070-7382-46a9-b2b7-6bb253732877"
} }

View File

@ -3,15 +3,9 @@
"object": { "object": {
"actor": "http://enterprise.lemmy.ml/u/lemmy_beta", "actor": "http://enterprise.lemmy.ml/u/lemmy_beta",
"object": "http://ds9.lemmy.ml/post/1", "object": "http://ds9.lemmy.ml/post/1",
"cc": [
"https://www.w3.org/ns/activitystreams#Public"
],
"type": "Like", "type": "Like",
"id": "http://enterprise.lemmy.ml/activities/like/2227ab2c-79e2-4fca-a1d2-1d67dacf2457" "id": "http://enterprise.lemmy.ml/activities/like/2227ab2c-79e2-4fca-a1d2-1d67dacf2457"
}, },
"cc": [
"https://www.w3.org/ns/activitystreams#Public"
],
"type": "Undo", "type": "Undo",
"id": "http://enterprise.lemmy.ml/activities/undo/6cc6fb71-39fe-49ea-9506-f0423b101e98" "id": "http://enterprise.lemmy.ml/activities/undo/6cc6fb71-39fe-49ea-9506-f0423b101e98"
} }

View File

@ -3,15 +3,9 @@
"object": { "object": {
"actor": "http://ds9.lemmy.ml/u/lemmy_alpha", "actor": "http://ds9.lemmy.ml/u/lemmy_alpha",
"object": "http://ds9.lemmy.ml/comment/1", "object": "http://ds9.lemmy.ml/comment/1",
"cc": [
"https://www.w3.org/ns/activitystreams#Public"
],
"type": "Like", "type": "Like",
"id": "http://ds9.lemmy.ml/activities/like/efcf7ae2-dfcc-4ff4-9ce4-6adf251ff004" "id": "http://ds9.lemmy.ml/activities/like/efcf7ae2-dfcc-4ff4-9ce4-6adf251ff004"
}, },
"cc": [
"https://www.w3.org/ns/activitystreams#Public"
],
"type": "Undo", "type": "Undo",
"id": "http://ds9.lemmy.ml/activities/undo/3518565c-24a7-4d9e-8e0a-f7a2f45ac618" "id": "http://ds9.lemmy.ml/activities/undo/3518565c-24a7-4d9e-8e0a-f7a2f45ac618"
} }

View File

@ -21,7 +21,7 @@ use activitypub_federation::{
traits::ActivityHandler, traits::ActivityHandler,
utils::verify_urls_match, utils::verify_urls_match,
}; };
use activitystreams_kinds::{activity::UndoType, public}; use activitystreams_kinds::activity::UndoType;
use lemmy_api_common::utils::blocking; use lemmy_api_common::utils::blocking;
use lemmy_db_schema::{newtypes::CommunityId, source::community::Community, traits::Crud}; use lemmy_db_schema::{newtypes::CommunityId, source::community::Community, traits::Crud};
use lemmy_utils::error::LemmyError; use lemmy_utils::error::LemmyError;
@ -54,7 +54,6 @@ impl UndoVote {
let undo_vote = UndoVote { let undo_vote = UndoVote {
actor: ObjectId::new(actor.actor_id()), actor: ObjectId::new(actor.actor_id()),
object, object,
cc: vec![public()],
kind: UndoType::Undo, kind: UndoType::Undo,
id: id.clone(), id: id.clone(),
unparsed: Default::default(), unparsed: Default::default(),

View File

@ -13,7 +13,6 @@ use crate::{
PostOrComment, PostOrComment,
}; };
use activitypub_federation::{core::object_id::ObjectId, data::Data, traits::ActivityHandler}; use activitypub_federation::{core::object_id::ObjectId, data::Data, traits::ActivityHandler};
use activitystreams_kinds::public;
use anyhow::anyhow; use anyhow::anyhow;
use lemmy_api_common::utils::blocking; use lemmy_api_common::utils::blocking;
use lemmy_db_schema::{ use lemmy_db_schema::{
@ -37,7 +36,6 @@ impl Vote {
Ok(Vote { Ok(Vote {
actor: ObjectId::new(actor.actor_id()), actor: ObjectId::new(actor.actor_id()),
object: ObjectId::new(object.ap_id()), object: ObjectId::new(object.ap_id()),
cc: vec![public()],
kind: kind.clone(), kind: kind.clone(),
id: generate_activity_id(kind, &context.settings().get_protocol_and_hostname())?, id: generate_activity_id(kind, &context.settings().get_protocol_and_hostname())?,
unparsed: Default::default(), unparsed: Default::default(),

View File

@ -2,7 +2,7 @@ use crate::{
objects::person::ApubPerson, objects::person::ApubPerson,
protocol::{activities::voting::vote::Vote, Unparsed}, protocol::{activities::voting::vote::Vote, Unparsed},
}; };
use activitypub_federation::{core::object_id::ObjectId, deser::helpers::deserialize_one_or_many}; use activitypub_federation::core::object_id::ObjectId;
use activitystreams_kinds::activity::UndoType; use activitystreams_kinds::activity::UndoType;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use url::Url; use url::Url;
@ -12,8 +12,6 @@ use url::Url;
pub struct UndoVote { pub struct UndoVote {
pub(crate) actor: ObjectId<ApubPerson>, pub(crate) actor: ObjectId<ApubPerson>,
pub(crate) object: Vote, pub(crate) object: Vote,
#[serde(deserialize_with = "deserialize_one_or_many", default)]
pub(crate) cc: Vec<Url>,
#[serde(rename = "type")] #[serde(rename = "type")]
pub(crate) kind: UndoType, pub(crate) kind: UndoType,
pub(crate) id: Url, pub(crate) id: Url,

View File

@ -3,7 +3,7 @@ use crate::{
objects::person::ApubPerson, objects::person::ApubPerson,
protocol::Unparsed, protocol::Unparsed,
}; };
use activitypub_federation::{core::object_id::ObjectId, deser::helpers::deserialize_one_or_many}; use activitypub_federation::core::object_id::ObjectId;
use lemmy_utils::error::LemmyError; use lemmy_utils::error::LemmyError;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::convert::TryFrom; use std::convert::TryFrom;
@ -15,8 +15,6 @@ use url::Url;
pub struct Vote { pub struct Vote {
pub(crate) actor: ObjectId<ApubPerson>, pub(crate) actor: ObjectId<ApubPerson>,
pub(crate) object: ObjectId<PostOrComment>, pub(crate) object: ObjectId<PostOrComment>,
#[serde(deserialize_with = "deserialize_one_or_many", default)]
pub(crate) cc: Vec<Url>,
#[serde(rename = "type")] #[serde(rename = "type")]
pub(crate) kind: VoteType, pub(crate) kind: VoteType,
pub(crate) id: Url, pub(crate) id: Url,