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

only show ongoing/future pause notifications info #988

Merged
merged 3 commits into from
Jul 11, 2024

Conversation

petrjasek
Copy link
Member

@petrjasek petrjasek commented Jul 4, 2024

CPCN-844

Checklist

  • This pull request is not adding new forms that use redux
  • This pull request is adding missing TypeScript types to modified code segments where it's easy to do so with confidence
  • This pull request is replacing lodash.get with optional chaining for modified code segments

@petrjasek petrjasek added this to the v2.8 milestone Jul 4, 2024
Copy link
Member

@tomaskikutis tomaskikutis left a comment

Choose a reason for hiding this comment

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

Can you instead adjust the variable notificationsArePaused?

Also don't use greater/less than operators on strings. That's the worst heresy I've seen in last few years 😆 Despite all JS quirks it is still surprising it works at all.

@tomaskikutis
Copy link
Member

Also mark checklist items as done

@petrjasek
Copy link
Member Author

I can't adjust the variable because it should show the info also before the pause


if (notificationsArePaused) {
if (pausedFrom <= today && pausedTo >= today) {
Copy link
Member

Choose a reason for hiding this comment

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

I'd be easier to understand if you used variables. Maybe notificationsArePaused or notificationsWillBePaused or whatever you're checking for in that if condition.

pausedTo != '' && pausedTo >= today
);
const today = getTodayTimestamp();
const pausedFrom = parseISODate(props.fullUser.notification_schedule?.pause_from);
Copy link
Member

Choose a reason for hiding this comment

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

FYI you can parse by passing a string to constructor new Date('2024-01-01')

assets/utils.tsx Show resolved Hide resolved
@petrjasek petrjasek merged commit c2b39a7 into superdesk:develop Jul 11, 2024
7 checks passed
@petrjasek petrjasek deleted the fix-notifications-info branch July 11, 2024 06:13
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.

2 participants