Skip to content

Add 'unsubscribe from thread' action to Reply notifications#2943

Open
Hardeezah wants to merge 1 commit intostackernews:masterfrom
Hardeezah:unsubscribe-thread-notification
Open

Add 'unsubscribe from thread' action to Reply notifications#2943
Hardeezah wants to merge 1 commit intostackernews:masterfrom
Hardeezah:unsubscribe-thread-notification

Conversation

@Hardeezah
Copy link
Copy Markdown

Closes #2578

Add unsubscribeThread mutation
Add "unsubscribe from thread" action link under Reply notifications

Description

This PR adds an "Unsubscribe from thread" feature directly in the notifications page. It allows users to easily stop receiving notifications from long or noisy reply chains by unsubscribing from the current item and all its ancestors in one click.

Key changes:

  • Added unsubscribeThread(id: ID!): Item mutation to the GraphQL schema
  • Implemented the resolver using PostgreSQL’s ltree @> operator to efficiently delete all ancestor ThreadSubscription records in a single query
  • Updated the Reply notification component to display a small “unsubscribe from thread” link with immediate feedback (hides after success + toast message)

Screenshots

unsubscribe from thread

“unsubscribe from thread” action visible under Reply notifications

Additional Context

The mutation follows the existing tree structure patterns in the codebase using ltree path matching. This provides a much better user experience when dealing with notification spam from active comment threads.

Checklist

Are your changes backward compatible? Please answer below:

Yes. No breaking changes to the GraphQL API or database schema.

On a scale of 1-10 how well and how have you QA'd this change and any features it might affect? Please answer below:

9/10. Tested full subscription → notification → unsubscribe flow, verified database cleanup, confirmed no new notifications arrive after unsubscribing, and ran linting and tests.

For frontend changes: Tested on mobile, light and dark mode? Please answer below:

Yes. The UI uses existing Bootstrap utility classes and works correctly across mobile, desktop, light, and dark modes.

Did you introduce any new environment variables? If so, call them out explicitly here:

No.

Did you use AI for this? If so, how much did it assist you?

Yes, used for code review

Closes stackernews#2578

- Add unsubscribeThread mutation
- Add action link under Reply notifications
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.

Unsubscribe from parents / thread

1 participant