-
Notifications
You must be signed in to change notification settings - Fork 6
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
feat: unread first #429
feat: unread first #429
Conversation
" | ||
AND ( | ||
{unread_first_clause_left} | ||
NOW() - (SELECT created_at FROM subscriber_notification WHERE id={variable}), |
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.
Looks like there's no way to reverse the comparison for a specific field in the tuple, so have to make it subtract from a shared value to make it sort in reverse.
) | ||
subscriber_notification.is_read ASC, | ||
subscriber_notification.created_at DESC, | ||
subscriber_notification.id ASC |
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.
Technically this changes the sort order from higher ID first to lower ID first. But this was used as a tie-breaker only when created_at was the same. This just guarantees that when paginating that there is no risk of missing or duplicate notifications and I think it makes more sense to put lower IDs first in the tiebreaker.
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.
Super nice!
Description
Implement the
urf
flag as per the specsAlso rewrites some related test cases (that I just made in last PR) to be simpler and more maintainable.
Resolves #427
How Has This Been Tested?
New test cases
Due Diligence