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

fix(GuildScheduledEvent): handle null recurrence_rule #10543

Merged
merged 5 commits into from
Oct 11, 2024
Merged

fix(GuildScheduledEvent): handle null recurrence_rule #10543

merged 5 commits into from
Oct 11, 2024

Conversation

Eejit43
Copy link
Contributor

@Eejit43 Eejit43 commented Oct 8, 2024

Please describe the changes this PR makes and why it should be merged:

This PR handles a null recurrence_rule value in GuildScheduledEvents. If there is no rule, the value appears to always be null rather than not present.

Status and versioning classification:

  • Code changes have been tested against the Discord API, or there are no code changes
  • I know how to update typings and have done so, or typings don't need updating

@Eejit43 Eejit43 requested a review from a team as a code owner October 8, 2024 18:00
Copy link

vercel bot commented Oct 8, 2024

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

2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
discord-js ⬜️ Ignored (Inspect) Visit Preview Oct 9, 2024 2:57pm
discord-js-guide ⬜️ Ignored (Inspect) Visit Preview Oct 9, 2024 2:57pm

@almeidx almeidx added this to the discord.js 15.0.0 milestone Oct 8, 2024
Copy link
Member

@Jiralite Jiralite left a comment

Choose a reason for hiding this comment

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

When the recurrence rule is removed, Discord will send null. This means the proposed condition change will result in false where it goes to the else clause where nothing happens. The cached scheduled event is not updated and will be incorrect.

A proposed fix would be to leave the condition as it is and instead do this:

this.recurrenceRule = data.recurrenceRule && {...};

When null is received, it will be correctly set to null.

@Eejit43 Eejit43 requested a review from Jiralite October 9, 2024 14:54
@almeidx almeidx removed the in review label Oct 9, 2024
@kodiakhq kodiakhq bot merged commit 1925c11 into discordjs:main Oct 11, 2024
7 checks passed
@Eejit43 Eejit43 deleted the fix-GuildScheduledEvent-recurrence_rule branch October 11, 2024 05:52
Jiralite pushed a commit that referenced this pull request Oct 11, 2024
* fix(GuildScheduledEvent): handle null recurrence_rule

* refactor: consistency

* feat: implement suggested logic change

* fix: correct data.recurrence_rule check

---------

Co-authored-by: Almeida <github@almeidx.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

5 participants