-
-
Notifications
You must be signed in to change notification settings - Fork 7k
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 in memoriam accounts appearing in follow recommendations #31474
Fix in memoriam accounts appearing in follow recommendations #31474
Conversation
eb2ad37
to
b2cfa63
Compare
This comment was marked as outdated.
This comment was marked as outdated.
ad41a3b
to
a0ff865
Compare
When (or if 😅) this is merged, please preserve the notice of co-authorship by @kernal053 ! Should be as simple as leaving the commit message untouched, but I am not especially familiar with how this project uses GitHub PR's. 😌 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi! Thanks for your contribution! The change looks good to me, but could you add a couple tests in spec/models/account_suggestions
for this?
(As an aside, the follow_recommendations
materialized view will still store records for memorialized accounts, which is a (small) waste of resources, but this is ok because the number of trending memorialized accounts should be low. Furthermore, changing follow_recommendations
is much more complex as it involves tricky database migrations)
a0ff865
to
bb75dd9
Compare
We were discussing something similar for not ignoring "bot" accounts from recommendations, and thought about having the query return a bit more results, then filtering in Ruby to ignore the ones we dont want and limit to 30. Not sure if this is required here as I expect memorialized accounts to be less frequent than bot accounts in trends, but this may be a solution. |
In this case, this is ok as far as the actual results are concerned, the filtering is done in PostgreSQL and will return the expected number of results. The potential concern is about performance, but I do not think this is a concern for memorialized accounts since there are few of it. |
Filters out memorial accounts in the two account suggestions sources. Co-authored-by: Utkarsh Wankar <[email protected]>
740aeeb
bb75dd9
to
740aeeb
Compare
…n#31474) Co-authored-by: Utkarsh Wankar <[email protected]>
…n#31474) Co-authored-by: Utkarsh Wankar <[email protected]>
…n#31474) Co-authored-by: Utkarsh Wankar <[email protected]>
Further to #30466, this fix prevents in memoriam accounts from appearing in accounts' follow recommendations.
This is achieved by adding an extra restriction (
memorial: false
) in both of the following sources of these recommendations:app/models/account_suggestions/source.rb
app/models/account_suggestions/friends_of_friends_source.rb
Note - this does not invalidate any caches upon an admin "memorialising" a user. Since this action could hypothetically affect the recommendation cache for any account, and due to memorialisation being a one-off and irreversible operation, I did not see this as necessary.