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

[WIP] Add backend support for muting communities #3238

Closed
wants to merge 13 commits into from

Conversation

kartikynwa
Copy link
Contributor

@kartikynwa kartikynwa commented Jun 21, 2023

Fixes #3160

Adding backend support for muting communities in this PR.

The database schema and API are identical to that for blocking of communities.

Communities are muted/unmuted via /api/v3/community/mute endpoint and the request structure is identical to /community/blocking:

curl -i -H "Content-Type: application/json" -X POST \
  -d "{"mute": true,  "auth": "...",  "community_id": 3}" \
  "http://localhost:8536/api/v3/community/mute"

Where muting differs from blocking is that it only affects listing of posts when ListingType in PostQuery is All or Local and all of community_id, creator_id and search_term are not provided. Plus PostQuery takes an optional value show_muted. When this value is Option<true>, posts from muted communities are never hidden. I have tried to be conservative with making changes to default API behaviour which is why as things currently are, only the default output for /c/all and /c/local would be affected.

TODO

  • Have to update the API documentation but don't know how to do that yet.
  • There is a lot of code duplication from the community blocking. I am not sure how to modularise. Advice for it is welcome.
  • I don't understand the changes I made in the apub crate. I implemented the SendActivity trait so that compilation succeeds and I can test the changes locally. ActivityPub spec does not mention muting so not sure what to do here. Help appreciated.
  • Have to update tests for post_view.rs

@Nutomic
Copy link
Member

Nutomic commented Jun 21, 2023

This is already implemented as /api/v3/community/hide

@kartikynwa
Copy link
Contributor Author

kartikynwa commented Jun 21, 2023

@Nutomic hiding seems to be something that admins do. Like they can hide a community so that it doesn't appear on the front page for every user.

This PR is per user configuration like blocking. I can mute a community so that it does not appear in the all feed for me but continues to appear for other users (unless they choose to mute it too).

@dessalines
Copy link
Member

I still don't fully understand the difference between community blocking and muting. If I don't want to see a community, why not block it?

@kartikynwa
Copy link
Contributor Author

Blocking precludes you from interacting with the community in any way. If you mute a community, you can either visit it manually or follow a link to a post in that community and leave a comment there or vote if you want. It just won't appear in your feeds.

@dessalines
Copy link
Member

To be more clear then, this should be hide_from_feeds or hide_from_all_and_home . It wasn't clear to me and I'm sure it won't be to others.

@kartikynwa kartikynwa changed the title Add backend support for muting communities [WIP] Add backend support for muting communities Jul 12, 2023
@Nutomic
Copy link
Member

Nutomic commented Jul 12, 2023

Blocking precludes you from interacting with the community in any way. If you mute a community, you can either visit it manually or follow a link to a post in that community and leave a comment there or vote if you want. It just won't appear in your feeds.

I think theres an open issue about allowing you to browse a blocked community if you explicitly navigate to it, or view a post inside it. I think that would be a reasonable solution and it wouldnt require yet another setting.

@kartikynwa
Copy link
Contributor Author

That does sound like a better solution to me. I'll look into that and close the PR in a while.

@kartikynwa kartikynwa closed this Jul 14, 2023
@kartikynwa kartikynwa deleted the enhance-community-muting branch July 14, 2023 16:38
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.

option to mute communities from /all/
3 participants