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

navbar_alerts: Convert module to TypeScript. #30123

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

afeefuddin
Copy link
Collaborator

Self-review checklist
  • Self-reviewed the changes for clarity and maintainability
    (variable names, code reuse, readability, etc.).

Communicate decisions, questions, and potential concerns.

  • Explains differences from previous plans (e.g., issue description).
  • Highlights technical choices and bugs encountered.
  • Calls out remaining decisions and concerns.
  • Automated tests verify logic where appropriate.

Individual commits are ready for review (see commit discipline).

  • Each commit is a coherent idea.
  • Commit message(s) explain reasoning and motivation for changes.

Completed manual review and testing of the following:

  • Visual appearance of the changes.
  • Responsiveness and internationalization.
  • Strings and tooltips.
  • End-to-end functionality of buttons, interactions and flows.
  • Corner cases, error conditions, and easily imagined bugs.

const deadline = new Date(realm.demo_organization_scheduled_deletion_date * 1000);
export function get_demo_organization_deadline_days_remaining(): number {
const now = Date.now();
const deadline = new Date(realm.demo_organization_scheduled_deletion_date! * 1000).getTime();
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Should we remove this code and just use realm.demo_organization_scheduled_deletion_date! * 1000 ?

Copy link
Sponsor Member

@timabbott timabbott May 20, 2024

Choose a reason for hiding this comment

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

I'm not sure I understand the question? Or the choice to remove the new Date() wrapper?

Oh, is the idea that we'd just be subtracting UNIX timestamps?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, that's what I meant. Should we do that, or is this just fine?

Copy link
Sponsor Member

@timabbott timabbott May 28, 2024

Choose a reason for hiding this comment

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

Subtracting UNIX timestamps seems fine. But I don't like doing that in the same commit as the TS migration; it is very hard to check, and it seems like there's logic changes in multiple places in this file around adding/removing getTime calls. So maybe you can split that to a prep commit or follow-up commit to make those logic changes easier to review?

Copy link
Member

Choose a reason for hiding this comment

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

What justifies the unchecked !? There’s nothing that would prevent someone from changing code elsewhere to call this function while realm.demo_organization_scheduled_deletion_date is undefined, so this is not locally safe. Use assert instead.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done.

@andersk andersk added the area: typescript migration Issues for migrating Zulip to TypeScript label May 20, 2024
@afeefuddin
Copy link
Collaborator Author

The cancelled check seems unrelated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: typescript migration Issues for migrating Zulip to TypeScript size: L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants