$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()]);
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()]);
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.