Skip to content
Snippets Groups Projects

Issues/2980952: Update message on cancelling account with e-mail confirmation request.

Closed AKHIL BABU requested to merge issue/drupal-2980952:2980952-wrong-message-on into 11.x
2 unresolved threads

Closes #2980952

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
149 148 $this->entity->user_cancel_notify = $form_state->getValue('user_cancel_notify');
150 149 $this->entity->save();
151 150 _user_mail_notify('cancel_confirm', $this->entity);
152 $this->messenger()->addStatus($this->t('A confirmation request to cancel your account has been sent to your email address.'));
153 151 $this->logger('user')->info('Sent account cancellation request to %name %email.', ['%name' => $this->entity->label(), '%email' => '<' . $this->entity->getEmail() . '>']);
154 152
153 $messenger = $this->messenger();
154 if ($this->entity->id() == $this->currentUser()) {
  • David Cameron added 2167 commits

    added 2167 commits

    Compare with previous version

  • David Cameron added 1 commit

    added 1 commit

    Compare with previous version

  • David Cameron added 1 commit

    added 1 commit

    • db6c9342 - Reverted the remaining changes to assertions

    Compare with previous version

  • David Cameron added 1 commit

    added 1 commit

    • 80f90452 - Added a new test for the new admin cancellation message

    Compare with previous version

  • David Cameron added 1 commit

    added 1 commit

    • f08bee58 - Reverted other unrelated changes

    Compare with previous version

  • 149 149 $this->entity->user_cancel_notify = $form_state->getValue('user_cancel_notify');
    150 150 $this->entity->save();
    151 151 _user_mail_notify('cancel_confirm', $this->entity);
    152 $this->messenger()->addStatus($this->t('A confirmation request to cancel your account has been sent to your email address.'));
    153 152 $this->logger('user')->info('Sent account cancellation request to %name %email.', ['%name' => $this->entity->label(), '%email' => '<' . $this->entity->getEmail() . '>']);
    154 153
    154 $messenger = $this->messenger();
    155 if ($this->entity->id() == $this->currentUser()->id()) {
    156 $messenger->addStatus($this->t('A confirmation request to cancel your account has been sent to your email address.'));
    157 }
    158 else {
    159 $messenger->addStatus($this->t("A confirmation request to cancel the account %name has been sent to the user's email address.", ['%name' => $this->entity->label()]));
    160 }
    • Comment on lines +154 to +160

      any chance we can simplify? The action taken is the same in both branches of the condition, no need to duplicate it, just need to change the message in some cases.

      Suggested change
      Applied
      151 $messenger = $this->messenger();
      152 if ($this->entity->id() == $this->currentUser()->id()) {
      153 $messenger->addStatus($this->t('A confirmation request to cancel your account has been sent to your email address.'));
      154 }
      155 else {
      156 $messenger->addStatus($this->t("A confirmation request to cancel the account %name has been sent to the user's email address.", ['%name' => $this->entity->label()]));
      157 }
      151 $cancel_message = $this->t('A confirmation request to cancel your account has been sent to your email address.');
      152 if ($this->entity->id() !== $this->currentUser()->id()) {{
      153 $cancel_message = $this->t("A confirmation request to cancel the account %name has been sent to the user's email address.", ['%name' => $this->entity->label()]);
      154 }
      155 $this->messenger()->addStatus($cancel_message);
      Edited by Théodore Biadala
    • Please register or sign in to reply
  • David Cameron added 1 commit

    added 1 commit

    • 062623d9 - Apply 1 suggestion(s) to 1 file(s)

    Compare with previous version

  • David Cameron added 168 commits

    added 168 commits

    Compare with previous version

  • Please register or sign in to reply
    Loading