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

Fix exclusive lists interfering with notifications #28162

Merged
merged 5 commits into from
Dec 2, 2024

Conversation

ShadowJonathan
Copy link
Contributor

@ShadowJonathan ShadowJonathan commented Dec 1, 2023

Fixes #27316

I had to rename a parameter, and add a function, to make sure this didn't become too much of a messy hack, but i hope that this is at least still a similar level of cleanliness and understanding

The only annoyance is that this is now building crutches twice, the alternative for that would be to have some enum/flag/symbol kind of return ("hide from home, show notif", "don't show notif, hide from home", :skip_home, :filter), but that's a lot more refactoring

if that's the more clean solution, prompt me, then i'll try to refactor around it

@ShadowJonathan ShadowJonathan changed the title Fix notifications interfering with exclusive lists Fix exclusive lists interfering with notifications Dec 1, 2023
Copy link

codecov bot commented Dec 1, 2023

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (8710bdb) 82.74% compared to head (1d494ab) 82.74%.
Report is 1 commits behind head on main.

Files Patch % Lines
app/workers/feed_insert_worker.rb 50.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #28162   +/-   ##
=======================================
  Coverage   82.74%   82.74%           
=======================================
  Files        1038     1038           
  Lines       28221    28223    +2     
  Branches     4552     4552           
=======================================
+ Hits        23351    23354    +3     
  Misses       3784     3784           
+ Partials     1086     1085    -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ClearlyClaire
Copy link
Contributor

The only annoyance is that this is now building crutches twice

This could be an issue, as this part of the code is in a hot path. I think we might want to rework it so that Home, Notifications and List delivery happen in the same job unit, with a single call to build_crutches.

@renchap renchap added ruby Pull requests that update Ruby code lint fix 💅 labels Dec 1, 2023
@ShadowJonathan
Copy link
Contributor Author

@renchap not a lint fix, the additional code needed to wrap around

@ShadowJonathan
Copy link
Contributor Author

@ClearlyClaire does that mean that you/someone will eventually create a PR that refactors this code, and that this PR won't move forward?

@renchap renchap removed ruby Pull requests that update Ruby code lint fix 💅 labels Dec 1, 2023
@ClearlyClaire
Copy link
Contributor

@ClearlyClaire does that mean that you/someone will eventually create a PR that refactors this code, and that this PR won't move forward?

I experimented a bit, and the database schema does not lend itself well to what I was suggesting. So we probably want to keep the current split in jobs, at least for the time being, and instead look into keeping your PR but avoiding the duplicate work between filter?(:home, …) and filter_notification?.

@ShadowJonathan
Copy link
Contributor Author

ShadowJonathan commented Dec 1, 2023

Alright, would a symbol return (:unfiltered, :skip_home, :filtered) to filter? be a good solution then?

@mjankowski
Copy link
Contributor

I think this needs a rebase and CI is frozen, but also -- seems like we've been blocked for about a year on whether we can resolve the performance implications of double crutching?

@ShadowJonathan - do you want to rebase and continue to nudge this forward, or should we close?

@ShadowJonathan
Copy link
Contributor Author

I'll take a look at this, thanks for bumping

@ShadowJonathan
Copy link
Contributor Author

ShadowJonathan commented Nov 27, 2024

Rebased on (my 2-day-old cached local copy of) main

@ShadowJonathan
Copy link
Contributor Author

Alright, would a symbol return (:unfiltered, :skip_home, :filtered) to filter? be a good solution then?

@ClearlyClaire this has been a year in the making, but what's your opinion on this?

@ClearlyClaire
Copy link
Contributor

What about either a symbol or nil? :filtered if filtered, :skip_home if filtered for home when checking for notifications, and nil otherwise. That way, the truthy behavior evaluation stays the same, but you can still discriminate between :skip_home and :filtered in FeedInsertWorker?

@ShadowJonathan
Copy link
Contributor Author

ShadowJonathan commented Nov 28, 2024

Didn't know that symbols were truthy and nil was falsey, but yes, that sounds perfect. I'll implement that.

@ShadowJonathan
Copy link
Contributor Author

@ClearlyClaire @mjankowski this PR is ready for review.

@ClearlyClaire
Copy link
Contributor

Ah, this is a little more awkward and involved than I anticipated, and I missed the bit about the function being called filter?; by convention, this should return a boolean… I guess having filter and filter? that just wraps around it would make sense.

@ShadowJonathan
Copy link
Contributor Author

@ClearlyClaire applied! The PR should be much cleaner to review now ^^

Copy link
Contributor

@ClearlyClaire ClearlyClaire left a comment

Choose a reason for hiding this comment

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

I wonder if there's a way to make it read less awkward, but it's not too bad, and it should fix an actual issue.

Copy link
Contributor

@mjankowski mjankowski left a comment

Choose a reason for hiding this comment

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

I see changes to existing specs to handle the signature change - should there be new spec for the fixed/change list scenario here?

@ClearlyClaire ClearlyClaire added this pull request to the merge queue Dec 2, 2024
Merged via the queue into mastodon:main with commit 360b6d3 Dec 2, 2024
27 checks passed
@ShadowJonathan ShadowJonathan deleted the fix-notifications branch December 2, 2024 10:09
@ClearlyClaire ClearlyClaire added the to backport PR needed to be backported label Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
to backport PR needed to be backported
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"Hide these posts from home" mutes explicit notification setting
4 participants