Skip to content

Conversation

@mdperez86
Copy link
Contributor

@mdperez86 mdperez86 commented Nov 23, 2022

All Submissions:

Changes proposed in this Pull Request:

What happened here was that anytime we want to use an emoji as part of a text message inside of a notice the following happends:
We expect the message to looks like 🎉 Product successfully updated.
but that string is converted to:

<>
  <image src="..." class="emoji" />
  "Product successfully updated."
</>

so any blank space between the image and the string literal is trimmed, resulting in 🎉Product successfully updated..

To avoid this behaviour my suggestions here is to add an invisible charater + the blank space at the begining of the string literal 🎉[U+200E] Product successfully updated. to prevent the trimming process. So the rendered result should looks like:

<>
  <image src="..." class="emoji" />
  "[U+200E] Product successfully updated."
</>

Note: [U+200E] is an invisible unicode character and not a blank space.

Closes #35541
Closes #35716

  • This PR is a very minor change/addition and does not require testing instructions (if checked you can ignore/remove the next section).

How to test the changes in this Pull Request:

  1. Go to Products -> Add New (MVP) page
  2. Create, update, save as draft a product and a notice should be shown.
  3. If the notice message contains an emoji, it should has a visible blank space between the emoji and the message.
  4. Like: 🎉 Product successfully updated.

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you created a changelog file for each project being changed, ie pnpm --filter=<project> changelog add?

FOR PR REVIEWER ONLY:

  • I have reviewed that everything is sanitized/escaped appropriately for any SQL or XSS injection possibilities. I made sure Linting is not ignored or disabled.

@mdperez86 mdperez86 self-assigned this Nov 23, 2022
@github-actions github-actions bot added focus: react admin plugin: woocommerce Issues related to the WooCommerce Core plugin. labels Nov 23, 2022
),
}
);
createNotice( 'success', `🎉‎ ${ noticeContent }`, {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Github does not show the unicode character here which is ‎[U+200E] and should be represented like 🎉‎[U+200E] ${ noticeContent }.

),
}
);
createNotice( 'success', `🎉‎ ${ noticeContent }`, {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same as previous comment

Copy link
Contributor

@AnnaMag AnnaMag Nov 24, 2022

Choose a reason for hiding this comment

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

@mdperez86 there is a related issue that removes the duplicated copy Product published. View in store.. Could we handle it here? ( Remove the View in store.).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, so we can close this one

'Successfully moved product to Trash.',
'woocommerce'
);
createNotice( 'success', `🎉‎ ${ noticeContent }` );
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same as previous comment

@github-actions
Copy link
Contributor

github-actions bot commented Nov 23, 2022

Test Results Summary

Commit SHA: d8eeed3

Test 🧪Passed ✅Failed 🚨Broken 🚧Skipped ⏭️Unknown ❔Total 📊Duration ⏱️
API Tests25900202610m 50s
E2E Tests186006019214m 17s

To view the full API test report, click here.
To view the full E2E test report, click here.
To view all test reports, visit the WooCommerce Test Reports Dashboard.

status,
} ).then(
( newProduct ) => {
const noticeContent =
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick, if we move this inside the conditional (if ( ! skipNotice ) {) we will set the const noticeContent knowing that we will use it, otherwise, we could set it without using it later.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right!!! thanks

octaedro
octaedro previously approved these changes Nov 24, 2022
Copy link
Contributor

@octaedro octaedro left a comment

Choose a reason for hiding this comment

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

Good job @mdperez86, this is testing well and code looks good. I just left a small suggestion, not a blocker at all, so I'll approve this PR.

AnnaMag
AnnaMag previously approved these changes Nov 24, 2022
Copy link
Contributor

@AnnaMag AnnaMag left a comment

Choose a reason for hiding this comment

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

Thanks @mdperez86. I left a small request from a related issue (copy removal).

LGTM

),
}
);
createNotice( 'success', `🎉‎ ${ noticeContent }`, {
Copy link
Contributor

@AnnaMag AnnaMag Nov 24, 2022

Choose a reason for hiding this comment

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

@mdperez86 there is a related issue that removes the duplicated copy Product published. View in store.. Could we handle it here? ( Remove the View in store.).

@mdperez86 mdperez86 dismissed stale reviews from AnnaMag and octaedro via 7655641 November 24, 2022 19:19
Copy link
Contributor

@AnnaMag AnnaMag left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks!

@mdperez86 mdperez86 merged commit 410f06b into trunk Nov 25, 2022
@mdperez86 mdperez86 deleted the fix/35541 branch November 25, 2022 13:21
@github-actions github-actions bot added this to the 7.3.0 milestone Nov 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

plugin: woocommerce Issues related to the WooCommerce Core plugin.

Projects

None yet

4 participants