Skip to content
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

Implement private communities #5076

Merged
merged 64 commits into from
Nov 7, 2024
Merged

Implement private communities #5076

merged 64 commits into from
Nov 7, 2024

Conversation

Nutomic
Copy link
Member

@Nutomic Nutomic commented Oct 3, 2024

See https://github.com/LemmyNet/rfcs/blob/main/0005-private-communities.md

  • Add CommunityVisibility::Private
  • Change CommunityFollower.pending (bool) to CommunityFollower.state (Accepted/Pending,ApprovalRequired)
  • Unit tests to assure only accepted followers and admins can view posts/comments in private communities
  • New API endpoints GET /community/pending_follows/count, GET /community/pending_follows/list, POST /community/pending_follows/approve
  • API test for the above endpoints
  • Federation
  • Enabled signed fetch by default to allow fetching content in private communities
  • Mark content in private communities as not public, and check this when receiving
  • API tests for federation
  • Add field is_new_instance for /api/v3/community/pending_follows/list items
  • Send reject activity if new follower is not accepted
  • Hide private content in RSS feeds (not necessary, already handled via post_view.rs

@Nutomic Nutomic force-pushed the private-community branch from fa6d326 to 3d416dd Compare October 3, 2024 13:04
@Nutomic Nutomic force-pushed the private-community branch from 8fa2cee to 1a8d103 Compare October 8, 2024 13:19
@Nutomic Nutomic force-pushed the private-community branch 2 times, most recently from fe83b43 to ad532f5 Compare October 8, 2024 13:47
@Nutomic Nutomic force-pushed the private-community branch from ad532f5 to 68d4ca9 Compare October 8, 2024 13:49
@Nutomic
Copy link
Member Author

Nutomic commented Oct 31, 2024

Found the problem, the ci check for check_diesel_schema was not working correctly and it actually changed schema.rs while running migrations. The thing is with the extra foreign key reference, community_follower isnt joinable to person anymore, so the on clause has to be specified explicity every time.

Comment on lines 247 to 257
#[derive(Debug, Serialize, Deserialize, Clone)]
#[cfg_attr(feature = "full", derive(TS))]
#[cfg_attr(feature = "full", ts(export))]
pub struct ListCommunityPendingFollows {
/// Only shows the unapproved applications
pub pending_only: Option<bool>,
// Only for admins, show pending follows for communities which you dont moderate
pub all_communities: Option<bool>,
pub page: Option<i64>,
pub limit: Option<i64>,
}
Copy link
Member

Choose a reason for hiding this comment

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

Should probably have a skip_serializing_none.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed

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.

Besidel @SleeplessOne1917 's comment everything looks good. I updated from main in case that was one of the test failures.

@Nutomic
Copy link
Member Author

Nutomic commented Nov 5, 2024

I fixed one test failure, but now it keeps throwing this error which I cant reproduce locally, and seems completely unrelated.

@Nutomic Nutomic enabled auto-merge (squash) November 6, 2024 09:06
@Nutomic Nutomic merged commit ad90cd7 into main Nov 7, 2024
2 checks passed
@SleeplessOne1917 SleeplessOne1917 deleted the private-community branch November 7, 2024 13:53
@Nutomic Nutomic mentioned this pull request Jan 24, 2025
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.

5 participants