WordPress.org

Make WordPress Core

Opened 7 months ago

Closed 7 months ago

Last modified 7 months ago

#40858 closed enhancement (fixed)

Upgrade Twemoji to 2.3.0

Reported by: peterwilsoncc Owned by: peterwilsoncc
Milestone: 4.8 Priority: normal
Severity: normal Version:
Component: Emoji Keywords: commit dev-reviewed
Focuses: Cc:

Description

Twemoji 2.3.0 was released overnight to support Emoji 5

Diff https://github.com/twitter/twemoji/compare/v2.2.5...v2.3.0

Required:

  • Update CDN (see meta ticket)
  • Update flag test (England, Scotland or Wales)
  • Update person test
  • Script

Attachments (2)

40858.diff (19.8 KB) - added by peterwilsoncc 7 months ago.
40858.2.diff (1.7 KB) - added by peterwilsoncc 7 months ago.

Download all attachments as: .zip

Change History (19)

#1 @peterwilsoncc
7 months ago

  • Owner set to peterwilsoncc
  • Status changed from new to assigned

#2 @Otto42
7 months ago

  • Type changed from defect (bug) to enhancement

@peterwilsoncc
7 months ago

#3 @peterwilsoncc
7 months ago

  • Owner changed from peterwilsoncc to pento

Updated tests:

  • English flag using 5 letter sub-division code
  • Replace emoji 4 tests with emoji 5's bearded person

Giving this to you @pento as you have the requisite CDN commit.

Local testing prior to the CDN being loaded will require the following filters and hosting the images locally.

<?php

function wp40858_filtered_emoji_svn_cdn( $cdn = '' ) {
        return 'http://src.wordpress-develop.dev/path/to/svg/';
}

function wp40858_filtered_emoji_png_cdn( $cdn = '' ) {
        return 'http://src.wordpress-develop.dev/path/to/72x72/';
}

add_filter( 'emoji_svg_url', 'wp40858_filtered_emoji_svn_cdn' );

add_filter( 'emoji_url', 'wp40858_filtered_emoji_png_cdn' );

#4 @pento
7 months ago

  • Owner changed from pento to peterwilsoncc

Finally, I can properly express myself in emoji.

https://s.w.org/images/core/emoji/2.3/72x72/1f9d4-1f3fb.png

#5 @peterwilsoncc
7 months ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 40837:

Emoji: Add Emoji 5 support.

Updates Twemoji to 2.3.0 to include Emoji 5 support.

The pride flag test is replaced with a test for the English flag, a five character sub-devision locale. The UN flag test is retained as the most recent two character locale.

An Emoji 5 "bearded person" replaces both Emoji 4 tests.

Fixes #40858.

#6 follow-up: @superpoincare
7 months ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

This seems to be not working in Safari in Mac Sierra.

Test screenshot below:

http://i.imgur.com/moMu6bB.jpg

The first is the England flag. The second is bearded person. The third is the UN flag.

The test site is: http://charming-okapi.w4.poopy.life/2017/05/26/test/

I used the Wordpress beta tester plugin to upgrade to the Wordpress nightly build which seems to have the code added in this ticket.

(Sorry for the bad site name but the site creators chose it for a reason).

#7 in reply to: ↑ 6 @peterwilsoncc
7 months ago

Replying to superpoincare:

This seems to be not working in Safari in Mac Sierra.

Thanks for the catch.

Testing in https://jsbin.com/fogoxac/13/edit?js,output shows two things:

  • In the last commit, I introduced a bug comparing the UN flag to a broken pride flag. This causes the flag test to pass.
  • In Safari, Fitzpatrick skin tone modifiers are displayed as tofu if they follow a tofu and as the skin tone if they follow a zero-width space. This causes the bearded person test to pass

To mitigate this I'll remove the skin tone modifier from our bearded person and compare the UN flag to a broken UN flag.

#8 follow-up: @peterwilsoncc
7 months ago

In 40858.2.diff:

  • Fixes the UN flag bug introduced in [40837]
  • Replaces the bearded person check with a male fairy. Emoji 5 does not have gendered bearded people, so I needed to switch it out so I could use the ZWJ/ZWS check for broken render.

Reduced tests case: https://jsbin.com/fogoxac/18/edit?js,output

@superpoincare are you able to check this patch?

#9 in reply to: ↑ 8 @Otto42
7 months ago

Replying to peterwilsoncc:

skin tone modifiers are displayed as tofu if they follow a tofu and as the skin tone if they follow a zero-width space. This causes the bearded person test to pass

To mitigate this I'll remove the skin tone modifier from our bearded person and compare the UN flag to a broken UN flag.

Replaces the bearded person check with a male fairy. Emoji 5 does not have gendered bearded people, so I needed to switch it out so I could use the ZWJ/ZWS check for broken render.

This may be the most interesting and appealing set of comments in an open source project that I have ever seen.

Well done. Props to you, good sir.

#10 @superpoincare
7 months ago

Hi Peter,

It's working now.

I was able to test by modifying the file formatting.php in the wp-includes folder with the diff.

The test site is http://glorious-serval.w3.poopy.life/

and this is the screenshot:

http://i.imgur.com/5iMg29N.png

So works!

#11 @peterwilsoncc
7 months ago

  • Keywords commit added

Thanks for checking. I've labeled it commit ready & will arrange for another set of eyes to go over it as core is in RC.

This ticket was mentioned in Slack in #core by peterwilsoncc. View the logs.


7 months ago

#13 @pento
7 months ago

Dooooooo iiiiitttttttt.

#14 follow-up: @superpoincare
7 months ago

Shouldn't emoji4 in the file wp-emoji-loader.js be emoji5?

Such as

case 'emoji5'

instead of

case 'emoji4'


and emoji51 and emoji52 instead of emoji41 and emoji42.

(Just the naming, otherwise seems to run fine.

#15 in reply to: ↑ 14 @peterwilsoncc
7 months ago

  • Keywords dev-reviewed added

Replying to superpoincare:

Shouldn't emoji4 in the file wp-emoji-loader.js be emoji5?

I caught that after the event too but will fix when WordPress 4.9 opens for commits, it's not important enough for an RC.

I'm inclined to refactor slightly similar to the method in the tests as repeating the code has lead to a couple of mistakes recently.

I've converted Dooooooo iiiiitttttttt to dev-reviewed and will commit shortly.

#16 @pento
7 months ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 40850:

Emoji: Fix the flag and emoji5 tests not working correctly.

Fixes the UN flag not being correctly compared to itself, introduced in [40837].

Replaces the bearded person check with a male fairy. Emoji 5 does not have gendered bearded people, so we needed to switch it out to use the ZWJ check for a broken render.

Props peterwilsoncc for the code and commit message.
Fixes #40858.

#17 @pento
7 months ago

@peterwilsoncc: I like the refactor idea, could you create a new ticket to handle that, please?

Note: See TracTickets for help on using tickets.