Skip to content

Federate community reports #5496

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 39 commits into
base: main
Choose a base branch
from

Conversation

dullbananas
Copy link
Collaborator

@dullbananas dullbananas commented Mar 11, 2025

Closes #4897

@dullbananas dullbananas marked this pull request as ready for review March 18, 2025 04:23
}
})
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can directly use Either via get dependency in Cargo.toml:

activitypub_federation = { 
  git = "https://github.com/LemmyNet/activitypub-federation-rust.git", 
  branch = "object-either", 
  default-features = false, 
  features = [
  "actix-web",
] }

@@ -107,13 +107,57 @@ impl Object for SiteOrCommunity {
}
}

impl Actor for SiteOrCommunity {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also implemented Either for Actor.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does that mean this should come after LemmyNet/activitypub-federation-rust#139, or that its just something to keep in mind.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -107,13 +107,57 @@ impl Object for SiteOrCommunity {
}
}

impl Actor for SiteOrCommunity {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does that mean this should come after LemmyNet/activitypub-federation-rust#139, or that its just something to keep in mind.

) -> LemmyResult<()> {
// admin action comes from the correct instance, so it was presumably done
// by an instance admin.
// TODO: federate instance admin status and check it here
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this would need to be skipped until we federate admins?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We currently assume that any user who is on the same instance as a user or community can perform admin actions on them. This is also in the existing code. It works fine because the remote Lemmy instance performs its own permission checks, and admin actions only federate for users/communities from the same instance.

@dessalines
Copy link
Member

Just needs above comments addressed, and conflicts, then we can merge.

@dullbananas dullbananas marked this pull request as draft March 25, 2025 02:53
@dullbananas dullbananas marked this pull request as ready for review April 8, 2025 01:23
let community = self.to[0].dereference(context).await?;
Ok(community)
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its easier to keep this impl and return an error in case of community, then you dont need match in the activity_lists.rs function.

object_id: Url,
actor: Person,
report_creator: Person,
site: Site,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be called CreateCommunityReport and ResolveCommunityReport to be clear.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On L97, why not just split out all the different report types like we do for everything else here?

IE CreateCommentReport, CreatePrivateMessageReport, etc

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its unnecessary because they are federated with the same activity, so it would only lead to duplicate code which does the exact same thing.

Also the name is probably fine as is because we might also want to federate private message reports later. And CreateCommunityReport can sound like reporting something in a community.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed these variants and made the other two report variants use Either

&self,
context: &Data<LemmyContext>,
) -> LemmyResult<Either<ApubSite, ApubCommunity>> {
self.object.receiver(context).await
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method is unnecessary, you can directly write activity.object.receiver()

@Nutomic
Copy link
Member

Nutomic commented Apr 8, 2025

Please write an api test as well to ensure that it works, and keeps working in the future.

Copy link
Member

@dessalines dessalines left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2nded on adding an API test, that'd be good to have just in case. LMK if you need help with that.

Comment on lines 39 to 47
ActivityChannel::submit_activity(
SendActivityData::SendResolveReportToSite {
object_id: community_report_view.community.ap_id.inner().clone(),
actor: local_user_view.person,
report_creator: community_report_view.creator.clone(),
site,
},
&context,
)?;
Copy link
Collaborator

@Nothing4You Nothing4You Apr 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's a good idea to allow admins of another instance to resolve a local community report.

While reports of posts and comments are currently mostly considered to be mod responsibility, communities are always admin responsibility.
Communities can very much be violating the reporter's instance rules, such as a remote porn community on an instance not allowing porn, but the community instance might be fine with that.

IMO the only case when a local community report of a remote community should get resolved through federation is when the community gets removed by an admin of the community instance, in all other cases the report should stay around for local admin review.

It could be allowed for an admin of the reporter's instance to federate resolving the report to the community instance, but this should likely only happen when the community does not get removed on the reporter's instance, when the admin determines the report not to be actionable.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be opened as a separate issue

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it might make sense to extract the entire functionality of federating resolving of community reports if you consider that too much for this PR, but imo this shouldn't be merged with full federation of resolving those reports in the first place and then ripping it out again after merging this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What exact actions could a local admin take in response to a remote admin resolving a community report?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

best example is an instance that doesn't allow nsfw content, but it federates with instances that allow this.

a user on the non-nsfw instance reports the community for being nsfw, which the community instance admin resolves as not actionable, as it's allowed there. the admin of the reporter's instance will still want to see the report to remove the community locally.

@dullbananas dullbananas marked this pull request as draft April 21, 2025 04:04
@dessalines
Copy link
Member

@dullbananas deployed a lemmy-js-client for you: 1.0.0-community-reports.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add ability to report a community
4 participants