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: orgs trigger alert when loading a calendar and no availability is found #14796
feat: orgs trigger alert when loading a calendar and no availability is found #14796
Conversation
Thank you for following the naming conventions! 🙏 Feel free to join our discord and post your PR link. |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
2 Ignored Deployments
|
if (input.hasOwnProperty("lockEventTypeCreation")) { | ||
data.lockEventTypeCreationForUsers = input.lockEventTypeCreation; | ||
} | ||
|
||
if (input.hasOwnProperty("adminGetsNoSlotsNotification")) { | ||
data.adminGetsNoSlotsNotification = input.adminGetsNoSlotsNotification; | ||
} |
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.
We have to construct data property so we only update what has changed - allows us to pass in only the orgSetting we want to update and not have the previous state of for data before
const NO_SLOTS_NOTIFICATION_FREQUENCY = IS_PRODUCTION ? 604_800 : 60; | ||
|
||
const NO_SLOTS_COUNT_FOR_NOTIFICATION = 2; |
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.
We will make these options configureable on a perOrg basis if required.
Will allign with customer to find out what they want initally
Graphite Automations"Add consumer team as reviewer" took an action on this PR • (04/29/24)1 reviewer was added to this PR based on Keith Williams's automation. |
// We may need to get more data and check the startDate occurrence of this | ||
// Not trigger email if the start months are the same | ||
const usersExistingNoSlots = await redis.lrange(usersUniqueKey, 0, NO_SLOTS_COUNT_FOR_NOTIFICATION - 1); | ||
await redis.lpush(usersUniqueKey, constructDataHash(eventDetails)); |
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.
lpush creates and pushes to key if no key is found
if (!usersExistingNoSlots.length) { | ||
await redis.expire(usersUniqueKey, NO_SLOTS_NOTIFICATION_FREQUENCY); | ||
} |
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.
If this is the first push to the key - we push a expiry date (to the key not each item in the array)
📦 Next.js Bundle Analysis for @calcom/webThis analysis was generated by the Next.js Bundle Analysis action. 🤖 This PR introduced no changes to the JavaScript bundle! 🙌 |
…er-alert-when-loading-a-calendar-and-no-availability-is' into sean/cal-3480-trigger-alert-when-loading-a-calendar-and-no-availability-is
packages/trpc/server/routers/viewer/slots/handleNotificationWhenNoSlots.ts
Outdated
Show resolved
Hide resolved
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.
PR looks good to me.
What we need to see though is if the latency added to getSchedule due to this is significant or not.
Awesome work @sean-brydon 🙏 |
…alendar-and-no-availability-is
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.
Giving another reapproval for @hariombalhara
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.
LGTM.
@sean-brydon Great PR. One suggestion for a follow-up.
|
Great idea - i cant find any tests currently for that file so we'd need to write them before implementing this |
@sean-brydon what a banger, just to double check, if a user within an org is added to an event-type — individual or collective and they don't have a calendar connected, that triggers a notification email to all org owners or admins? Is that programmable in terms of can that be turned on or off? Is there a nice pane to see this within the app outside of the members view which has the long list of apps per user — kind of like a filterable table |
What does this PR do?
Fixes CAL-3480
Fixes #14609
Loom: https://share.cleanshot.com/B5yBz18n
Type of change
How should this be tested?
Mandatory Tasks