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

Setting to hide PDs from "all discussions" page #183

Merged
merged 2 commits into from
Jun 1, 2023

Conversation

clarkwinkelmann
Copy link
Member

Changes proposed in this pull request:
Allow hiding private discussions from the "All discussions" page. The private discussions remain visible in the "Private discussions" page and in the discussion list of a user profile.

This PR was sponsored by a client.

Confirmed

  • Frontend changes: tested on a local Flarum installation.
  • Backend changes: tests are green (run composer test).

@luceos
Copy link
Contributor

luceos commented May 13, 2023

We originally removed this for performance reasons. Have you tested this at scale?

@clarkwinkelmann
Copy link
Member Author

We originally removed this

I had a suspicion it was different at some point but didn't remember the details.

Have you tested this at scale?

No, but I intentionally used a JOIN instead of subquery to avoid massive data transfers to and from the database.

Also the feature is behind a setting, so it can simply be disabled. The filter mutator should have negligible impact with the feature disabled.

I was not planning any further performance testing. Only if my client needs it. If you prefer we can start by running a fork and report back with the findings later. But since it's behind a setting I think we could benefit from letting more people test it "for us".

@luceos luceos requested a review from imorland May 16, 2023 17:52
@luceos
Copy link
Contributor

luceos commented May 16, 2023

@imorland what is your opinion on this?

@clarkwinkelmann
Copy link
Member Author

Since the private-visibility query is additive, there would be another way to achieve this that is guaranteed by design to have no impact. Instead of adding another condition to the query to cancel out the first, I could build the query in a way so that the code in the visibility scope disables itself with the action in the filter mutator, effectively adding no SQL for private discussions at all to the final query. I did something similar in my Collapsible Posts extension and I think I should be able to re-use that strategy (https://github.com/clarkwinkelmann/flarum-ext-collapsible-posts/blob/1458451c89844d059139389d0cb433c10b9c7cf7/src/Visibility/PostScope.php#L17 and https://github.com/clarkwinkelmann/flarum-ext-collapsible-posts/blob/1458451c89844d059139389d0cb433c10b9c7cf7/src/Controller/ListCollapsedPosts.php#L107)

My client has tested the current version of the PR on their server with ~50k discussions (I think that's the total of both public and private) and has not noticed any impact so far.

@luceos
Copy link
Contributor

luceos commented May 21, 2023

@clarkwinkelmann i would be okay with this. Can you merge and tag it?

Copy link
Member

@imorland imorland left a comment

Choose a reason for hiding this comment

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

Sorry for the delay here. Yep, I'm totally fine with this, thanks @clarkwinkelmann

@imorland imorland merged commit cf2af6b into master Jun 1, 2023
@imorland imorland deleted the cw/hide-from-all-discussions-page branch June 1, 2023 16:48
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.

4 participants