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

feat: unread first #429

Merged
merged 1 commit into from
Mar 21, 2024
Merged

feat: unread first #429

merged 1 commit into from
Mar 21, 2024

Conversation

chris13524
Copy link
Member

@chris13524 chris13524 commented Mar 21, 2024

Description

Implement the urf flag as per the specs

Also 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

  • Breaking change
  • Requires a documentation update
  • Requires a e2e/integration test update

@chris13524 chris13524 self-assigned this Mar 21, 2024
"
AND (
{unread_first_clause_left}
NOW() - (SELECT created_at FROM subscriber_notification WHERE id={variable}),
Copy link
Member Author

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
Copy link
Member Author

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.

Copy link
Contributor

@geekbrother geekbrother left a comment

Choose a reason for hiding this comment

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

Super nice!

@chris13524 chris13524 merged commit 5d5e5ed into main Mar 21, 2024
14 of 17 checks passed
@chris13524 chris13524 deleted the feat/unread-first branch March 21, 2024 16:41
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.

feat: unread first flag
3 participants