FriendsOfFlarum / byobu

Well integrated, advanced private discussions for your Flarum forum.
https://discuss.flarum.org/d/4762-flagrow-by-bu-well-integrated-advanced-private-discussions
MIT License
54 stars 33 forks source link

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

Closed clarkwinkelmann closed 1 year ago

clarkwinkelmann commented 1 year ago

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

luceos commented 1 year ago

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

clarkwinkelmann commented 1 year ago

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 commented 1 year ago

@imorland what is your opinion on this?

clarkwinkelmann commented 1 year ago

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 commented 1 year ago

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