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

Adjust boolean check of is_email_confirmed to suppress extraneous user activation events #3163

Merged
merged 2 commits into from
Nov 11, 2021

Conversation

grimmdude
Copy link
Contributor

@grimmdude grimmdude commented Nov 11, 2021

Fixes #2713

Changes proposed in this pull request:

Instead of explicilty checking for a true value, adjust to check if is_email_confirmed evaluates to true. This matches the approach currently being used elsewhere in the User model, and will prevent the Activated event from being fired every time a user confirms their email.

Existing usage of this approach:
https://github.com/flarum/core/blob/5f110f73e7858741907665b1ec8b5c372be99796/src/User/User.php#L725-L727

Reviewers should focus on:

Activating an already activated user.

Necessity

  • Has the problem that is being solved here been clearly explained?
  • If applicable, have various options for solving this problem been considered?
  • For core PRs, does this need to be in core, or could it be in an extension?
  • Are we willing to maintain this for years / potentially forever?

Confirmed

  • Frontend changes: tested on a local Flarum installation.
  • Backend changes: tests are green (run composer test).
  • Core developer confirmed locally this works as intended.
  • Tests have been added, or are not appropriate here.

Copy link
Member

@askvortsov1 askvortsov1 left a comment

Choose a reason for hiding this comment

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

Thank you for (yet another) PR! I think this might be the most PRs we've seen from a new contributor in one day 😁. Approving pending style fixes.

Copy link
Member

@SychO9 SychO9 left a comment

Choose a reason for hiding this comment

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

Thank you for the PR!

Eventually, we should use an eloquent attribute cast to boolean, but probably for a major release.

@askvortsov1 askvortsov1 merged commit 4ffc26a into flarum:master Nov 11, 2021
@grimmdude grimmdude deleted the suppress_activate_event branch November 11, 2021 20:53
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.

Activated event is sent every time an email is confirmed instead of just once
3 participants