Skip to content

feat: dynamic time format rendering in workflows based on user settings#10229

Merged
CarinaWolli merged 10 commits intocalcom:mainfrom
montocoder:dynamic-time-format-for-workflow-reminders
Jul 19, 2023
Merged

feat: dynamic time format rendering in workflows based on user settings#10229
CarinaWolli merged 10 commits intocalcom:mainfrom
montocoder:dynamic-time-format-for-workflow-reminders

Conversation

@montocoder
Copy link
Copy Markdown
Contributor

What does this PR do?

This PR introduces functionality to render the time format for tokens in EVENT_DATE and START_DATE within workflow message templates, based on the user's preference set in /settings/general (24h vs 12h). This has been accomplished by adding an additional timeFormat parameter to all workflow message templates and ensuring this parameter is included wherever these templates are called. The timeFormat value is obtained from user.timeFormat.

Requirement/Documentation

  • User's time format preference (12h vs 24h) should be reflected in EVENT_DATE, START_DATE tokens within workflow message templates.
  • Add an additional 'timeFormat' parameter to all workflow message templates.
  • Ensure the 'timeFormat' parameter is included in all instances where these templates are called.
  • The 'timeFormat' value should be derived from the user's timeFormat setting.

Type of change

  • New feature (non-breaking change which adds functionality)

How should this be tested?

Here are some test scenarios:

Setup

  • Build workflows (one for each trigger). Every workflow has all actions with all message templates

Triggers

  • Before event starts
  • When event is canceled
  • When new event is booked
  • After event ends
  • When event is rescheduled

Actions

  • Send email to host
  • Send email to attendees
  • Send SMS to attendee
  • Send SMS to a specific number

Message templates

  • Custom
  • Reminder
  • WhatsApp templates

Test case 1

  • Settings/general set time format to 24 hours perform all actions

Test case 2

  • Settings/general set time format to 12 hours perform all actions

Mandatory Tasks

  • Make sure you have self-reviewed the code.

Checklist

  • I have read the contributing guide
  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have checked if my PR needs changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@vercel
Copy link
Copy Markdown

vercel Bot commented Jul 18, 2023

@monto7926 is attempting to deploy a commit to the cal Team on Vercel.

A member of the Team first needs to authorize it.

@vercel
Copy link
Copy Markdown

vercel Bot commented Jul 18, 2023

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

Name Status Preview Comments Updated (UTC)
ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 19, 2023 1:24pm

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jul 18, 2023

Thank you for following the naming conventions! 🙏

@montocoder montocoder changed the title Render Date/Time Tokens in Workflow Templates Based on User's Time Format Settings fix: render workflow time format based on user's settings Jul 18, 2023
@montocoder montocoder changed the title fix: render workflow time format based on user's settings feat: render workflow time format based on user's settings Jul 18, 2023
@montocoder montocoder changed the title feat: render workflow time format based on user's settings feat: dynamic time format rendering in workflows based on user settings Jul 18, 2023
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jul 18, 2023

📦 Next.js Bundle Analysis for @calcom/web

This analysis was generated by the Next.js Bundle Analysis action. 🤖

One Page Changed Size

The following page changed size from the code in this PR compared to its base branch:

Page Size (compressed) First Load % of Budget (350 KB)
/workflows/[workflow] 393.42 KB 546.93 KB 156.26% (🟡 +0.15%)
Details

Only the gzipped size is provided here based on an expert tip.

First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If next/link is used, subsequent page loads would only need to download that page's bundle (the number in the "Size" column), since the global bundle has already been downloaded.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

The "Budget %" column shows what percentage of your performance budget the First Load total takes up. For example, if your budget was 100kb, and a given page's first load size was 10kb, it would be 10% of your budget. You can also see how much this has increased or decreased compared to the base branch of your PR. If this percentage has increased by 20% or more, there will be a red status indicator applied, indicating that special attention should be given to this. If you see "+/- <0.01%" it means that there was a change in bundle size, but it is a trivial enough amount that it can be ignored.

@CarinaWolli CarinaWolli requested a review from a team July 18, 2023 15:46
@PeerRich PeerRich added ✨ feature New feature or request workflows area: workflows, automations Low priority Created by Linear-GitHub Sync labels Jul 18, 2023
@PeerRich
Copy link
Copy Markdown
Member

hey @monto7926 can you look into the merge conflicts?

CleanShot 2023-07-18 at 23 15 56@2x

Copy link
Copy Markdown
Member

@CarinaWolli CarinaWolli left a comment

Choose a reason for hiding this comment

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

Tested and works 🙌🏻 Code looks good as well!

Thank you for your contribution 🙏

@CarinaWolli CarinaWolli merged commit 26e458b into calcom:main Jul 19, 2023
@montocoder montocoder deleted the dynamic-time-format-for-workflow-reminders branch July 24, 2023 08:35
fritterhoff pushed a commit to hm-edu/cal.com that referenced this pull request Jul 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

✨ feature New feature or request Low priority Created by Linear-GitHub Sync workflows area: workflows, automations

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants