Skip to content

Conversation

@andresgutgon
Copy link
Contributor

@andresgutgon andresgutgon commented Nov 20, 2025

What?

We want to let users know when an issue is escalating. To do that, we'll send an email to all members of workspaces that have activated notifications for escalating issues.

TODO

  • Send in batches of 100 emails to our email provider (max batch size is 1000)
  • Add tests to send escalating email handler
  • Add test to increment histogram
  • Check email is sent.
  • Allow users to skip receiving escalating issues.
  • Move user settings to a modal with a URL
  • Add footer on email to change notification preferences.
  • Design escalating email
  • Fix notifications URL. Now it check by workspace not membership
  • Check that not having the settings the email is not sent
  • Check with Mailgun to see if batch sending is working.
  • Squash and rebase

@andresgutgon andresgutgon force-pushed the feature/send-escalating-issue-email branch from 707802c to 6375d26 Compare November 21, 2025 10:49
return (
<DetailsPanel bordered ref={ref}>
<div className='relative w-full overflow-hidden'>
<div className='relative w-full overflow-hidden custom-scrollbar'>
Copy link
Contributor Author

@andresgutgon andresgutgon Nov 21, 2025

Choose a reason for hiding this comment

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

Fix sliding horizontal overflow ⚠️ (I'll do in another PR)

@andresgutgon andresgutgon force-pushed the feature/send-escalating-issue-email branch from e772320 to 1fa6e5e Compare November 25, 2025 14:45
subMonths,
subWeeks,
} from 'date-fns'
import type { RelativeDate } from '@latitude-data/core/constants'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

web-ui was coupled with core, I used sone UI components on emails and that gave me cycle dependencies. So I remove @latitude-data/core from web-ui and moved common parts to constants.

Web UI should never dependent on core. If a UI depends on core it belongs to apps/web

await cookies(),
)

if (parsedInput.redirectTo) {
Copy link
Contributor

Choose a reason for hiding this comment

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

why?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is used on the normal switch selector and now on the swich redirect for the notifications

Copy link
Contributor Author

Choose a reason for hiding this comment

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

🔥 All mails were moved

"react": "catalog:",
"react-dom": "catalog:",
"react-email": "4.0.3",
"@latitude-data/emails": "workspace:*",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Isolated so is easy to update and understand

"@dnd-kit/modifiers": "^9.0.0",
"@dnd-kit/utilities": "^3.2.2",
"@latitude-data/constants": "workspace:^",
"@latitude-data/core": "workspace:^",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

No dep with core 🔥

redirectTo: ROUTES.dashboard.notifications.root,
})

if (error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

why not add this as the onFailure of the action?

* so frontend can set the right session in cookies.
*
* 3. If the user has membership to that workspace and it's the current workspace
* we redirect to the default notifications page
Copy link
Contributor

Choose a reason for hiding this comment

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

tremenda logica

@andresgutgon andresgutgon force-pushed the feature/send-escalating-issue-email branch from 1fa6e5e to ec67b66 Compare November 25, 2025 15:32
)

const { execute: updateWeeklyEmail, isPending: isUpdatingWeeklyEmail } =
useLatitudeAction(updateWeeklyEmailPreferenceAction, {
Copy link
Contributor

Choose a reason for hiding this comment

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

nitpick: These two actions dont have to do with the currentUser entity, its more of a new "notification" store

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is totally related with the current user. Only current user can handle notifications. If this growth more we can move to another place

onSuccess: async ({ data: user }) => {
mutate(user) // Note: silent update
onSuccess: async () => {
mutate() // Get fresh data
Copy link
Contributor

Choose a reason for hiding this comment

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

why do we need to do an entire mutate if we have the user data?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because now the source of truth has changed. The notification settings related to the current user are on the backend only. So whenever the user change i refresh the frontend

Copy link
Contributor

Choose a reason for hiding this comment

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

You cant return them as part of the update user?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, but also do this fix the problem

We want to let users know when an issue is escalating. To do that we'll
send an email to all the members of the workspaces that have activated
the notifications for escalating issues.
@andresgutgon andresgutgon force-pushed the feature/send-escalating-issue-email branch from ec67b66 to 8443abf Compare November 25, 2025 15:54
Copy link
Contributor

@learningbizz learningbizz left a comment

Choose a reason for hiding this comment

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

Lots of files but, overall, I see things are good 👍 Good job!

@andresgutgon andresgutgon merged commit ee6e973 into main Nov 26, 2025
6 of 7 checks passed
@andresgutgon andresgutgon deleted the feature/send-escalating-issue-email branch November 26, 2025 08:33
@github-actions github-actions bot locked and limited conversation to collaborators Nov 26, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants