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

Notifications #155

Closed
wants to merge 1 commit into from
Closed

Notifications #155

wants to merge 1 commit into from

Conversation

tom-sherman
Copy link
Contributor

@tom-sherman tom-sherman commented Oct 19, 2024

Todo:

  • DB migration
  • Notification page UI polish
  • Check DB query isn't totally horrendous for the amount of rows read
  • Make notification count consistent with notification page read state
  • Pagination

Copy link

linear bot commented Oct 19, 2024

UN-77 Notifications

Copy link

vercel bot commented Oct 19, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
atproto-browser ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 3, 2024 7:02pm
frontpage ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 3, 2024 7:02pm
unravel ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 3, 2024 7:02pm

@tom-sherman
Copy link
Contributor Author

I've checked the DB query and the rows read scales with the total number of notifications for a given user (including both read and unread). Not bad but ideally it would factor in the limit and/or read state.

I tried adding indexes on created_at and read_at, but that didn't help. Maybe I need to tweak the query a little, or maybe new indexes don't take into consideration old data????

@tom-sherman
Copy link
Contributor Author

We agreed to mirror the bluesky UX as v1 which is to have no "mark as read" buttons and implicitly mark notifications as read when you open the page.

This means we can simply revalidate the notifications on navigation because the read state is much more ephemeral.

@tom-sherman
Copy link
Contributor Author

@WillCorrigan this is a feature

@WillCorrigan WillCorrigan added the design input needed Need approval from designer label Nov 2, 2024
@WillCorrigan
Copy link
Collaborator

@timothyis here are the initial cards, not much to look at and a bit same-y

all unread, dark mode:
image

all unread, light mode:
image

one marked as read (with the tick), dark mode:
image

one marked as read (with the tick), light mode:
image

packages/frontpage/drizzle.config.ts Outdated Show resolved Hide resolved
`id` integer PRIMARY KEY NOT NULL,
`did` text NOT NULL,
`created_at` text DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now')) NOT NULL,
`read_at` text,
Copy link
Collaborator

Choose a reason for hiding this comment

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

should this also be strftime?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's nullable so doesn't have a default.

: undefined,
),
)
.leftJoin(
Copy link
Collaborator

Choose a reason for hiding this comment

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

if the comment is deleted from db we prob don't want the notification to still be shown, so probably make it an inner join

schema.Comment,
eq(schema.Comment.id, schema.Notification.commentId),
)
.leftJoin(schema.Post, eq(schema.Post.id, schema.Comment.postId))
Copy link
Collaborator

Choose a reason for hiding this comment

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

same with this, inner join to avoid null post situation

id: integer("id").primaryKey(),
did: did("did").notNull(),
createdAt: dateIsoText("created_at").notNull().default(nowAsIsoString),
readAt: dateIsoText("read_at"),
Copy link
Collaborator

Choose a reason for hiding this comment

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

you can default this to strftime and leave it nullable maybe?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can't default it because it needs to be null to indicate not read.

packages/frontpage/app/(app)/notifications/page.tsx Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design input needed Need approval from designer frontpage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants