Follow-up to #2559445: Replace !placeholder with @placeholder in aggregator module

Problem/Motivation

In order to make #2506445: Replace !placeholder with @placeholder in t() and format_string() for non-URLs in tests approachable, we need to break it up into smaller chunks. This issue address !placeholder in the User module

See #2506427: [meta] !placeholder causes strings to be escaped and makes the sanitization API harder to understand for complete motivation on removal of !placeholder

Proposed resolution

Replace !placeholder with @placeholder in the User module.

core/modules/user/*

Remaining tasks

  1. Replace !placeholder with @placeholder. Refer to patch in #2506445-85: Replace !placeholder with @placeholder in t() and format_string() for non-URLs in tests as that patch should have related update
  2. Ensure tests come back clean
  3. Manually test the update and post screen shot after patch, review source for any difference in escaping.

User interface changes

Comments

joelpittet created an issue. See original summary.

borisson_’s picture

Status: Active » Needs review
StatusFileSize
new14.02 KB
joelpittet’s picture

Thanks @borisson_ feel free to grab as many as you'd like we are just laying out the plan, you are quick on the trigger:)
Are you on IRC?

Status: Needs review » Needs work

The last submitted patch, 2: replace_placeholder-2559459-2.patch, failed testing.

borisson_’s picture

@joelpittet, not on irc or online at all in the next week.

joelpittet’s picture

Dang cross-pollination! this failed on migrate D6. I'll see how that one fairs on it's own, this may need postponing or merging with that one.

andypost’s picture

Status: Needs work » Needs review
StatusFileSize
new1.29 KB
new12.73 KB

Tokens should be replaced properly, this fixes migrations

joelpittet’s picture

Good catch @andypost thank you, this one is good to review without any migrate integration.

joelpittet’s picture

Status: Needs review » Needs work
Issue tags: +Needs manual testing

Pointing out the locations for manual testing. Also there is a double escaping bug here from Html::escape() into @ placeholder

  1. +++ b/core/modules/user/src/AccountForm.php
    @@ -144,11 +144,11 @@ public function form(array $form, FormStateInterface $form_state) {
    -        $current_pass_description = $this->t('Required if you want to change the %mail or %pass below. !request_new.',
    +        $current_pass_description = $this->t('Required if you want to change the %mail or %pass below. @request_new.',
    

    This is on the user account page.

  2. +++ b/core/modules/user/src/Plugin/Validation/Constraint/UserMailRequired.php
    @@ -34,7 +34,7 @@ class UserMailRequired extends Constraint implements ConstraintValidatorInterfac
    -  public $message = '!name field is required.';
    +  public $message = '@name field is required.';
    

    Validation names

  3. +++ b/core/modules/user/src/Plugin/Validation/Constraint/UserMailRequired.php
    @@ -73,7 +73,7 @@ public function validate($items, Constraint $constraint) {
    -      $this->context->addViolation($this->message, ['!name' => Html::escape($account->getFieldDefinition('mail')->getLabel())]);
    +      $this->context->addViolation($this->message, ['@name' => Html::escape($account->getFieldDefinition('mail')->getLabel())]);
    

    We don't need the Html::escape() here and that will likely lead to double escaping.

  4. +++ b/core/modules/user/user.api.php
    @@ -122,7 +122,7 @@ function hook_user_cancel_methods_alter(&$methods) {
    -    $name = t('User !uid', array('!uid' => $account->id()));
    +    $name = t('User @uid', array('@uid' => $account->id()));
    

    This is a number so no need to test.

  5. +++ b/core/modules/user/user.module
    +++ b/core/modules/user/user.module
    @@ -54,19 +54,19 @@ function user_help($route_name, RouteMatchInterface $route_match) {
    

    These can be found on the help page and should be straight forward.

hog’s picture

StatusFileSize
new11.72 KB
new11.88 KB

Edited patch #9

hog’s picture

Status: Needs work » Needs review
hog’s picture

The last submitted patch, 10: replace_placeholder-2559459-10.patch, failed testing.

joelpittet’s picture

@HOG last patch had 0 bytes. Could you comment of a slight indication of what you are doing for each patch?

Not sure what you are attempting in #10 or #12

#9.3 to be clear is just removing the pre-escaping done by Html::escape()

Everything else is notes on where to find things for manual testing

hog’s picture

hog’s picture

StatusFileSize
new1.33 KB
new1.47 KB

#7 patch not applying, i'm rerolled it.

hog’s picture

StatusFileSize
new20.85 KB
new58.61 KB
new154.18 KB
new77.86 KB

alidation-names
mail-validation
help-page
accout-form

andypost’s picture

Status: Needs review » Reviewed & tested by the community

Looks enough

catch’s picture

Status: Reviewed & tested by the community » Postponed
justachris’s picture

Status: Postponed » Closed (duplicate)

Closing this, splitting by module was not the ideal approach to removing !placeholder. Marking as duplicate of #2506427: [meta] !placeholder causes strings to be escaped and makes the sanitization API harder to understand, since the chosen approach is / will be outlined there, please refer to it for any additional action.

xjm’s picture