1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-23 07:12:41 +01:00

Don't summon the emoji autocompleter for ":3"

Summary:
Fixes T12460. Also ":)", ":(", ":/", and oldschool ":-)" variants.

Not included are variants with actual letters (`:D`, `:O`, `:P`) and obscure variants (`:^)`, `:*)`).

Test Plan: Typed `:3` (no emoji summoned). Typed `:dog3` (emoji summoned). Typed `@3` (user autocomplete summoned).

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T12460

Differential Revision: https://secure.phabricator.com/D17577
This commit is contained in:
epriestley 2017-03-28 15:33:32 -07:00
parent 88798354e8
commit add1038109
3 changed files with 29 additions and 8 deletions

View file

@ -528,7 +528,7 @@ return array(
'rsrc/js/phui/behavior-phui-tab-group.js' => '0a0b10e9', 'rsrc/js/phui/behavior-phui-tab-group.js' => '0a0b10e9',
'rsrc/js/phuix/PHUIXActionListView.js' => 'b5c256b8', 'rsrc/js/phuix/PHUIXActionListView.js' => 'b5c256b8',
'rsrc/js/phuix/PHUIXActionView.js' => 'b3465b9b', 'rsrc/js/phuix/PHUIXActionView.js' => 'b3465b9b',
'rsrc/js/phuix/PHUIXAutocomplete.js' => '7c492cd2', 'rsrc/js/phuix/PHUIXAutocomplete.js' => '7910aacb',
'rsrc/js/phuix/PHUIXDropdownMenu.js' => '8018ee50', 'rsrc/js/phuix/PHUIXDropdownMenu.js' => '8018ee50',
'rsrc/js/phuix/PHUIXFormControl.js' => '83e03671', 'rsrc/js/phuix/PHUIXFormControl.js' => '83e03671',
'rsrc/js/phuix/PHUIXIconView.js' => 'bff6884b', 'rsrc/js/phuix/PHUIXIconView.js' => 'bff6884b',
@ -885,7 +885,7 @@ return array(
'phui-workpanel-view-css' => 'a3a63478', 'phui-workpanel-view-css' => 'a3a63478',
'phuix-action-list-view' => 'b5c256b8', 'phuix-action-list-view' => 'b5c256b8',
'phuix-action-view' => 'b3465b9b', 'phuix-action-view' => 'b3465b9b',
'phuix-autocomplete' => '7c492cd2', 'phuix-autocomplete' => '7910aacb',
'phuix-dropdown-menu' => '8018ee50', 'phuix-dropdown-menu' => '8018ee50',
'phuix-form-control-view' => '83e03671', 'phuix-form-control-view' => '83e03671',
'phuix-icon-view' => 'bff6884b', 'phuix-icon-view' => 'bff6884b',
@ -1456,6 +1456,12 @@ return array(
'multirow-row-manager', 'multirow-row-manager',
'javelin-json', 'javelin-json',
), ),
'7910aacb' => array(
'javelin-install',
'javelin-dom',
'phuix-icon-view',
'phabricator-prefab',
),
'7927a7d3' => array( '7927a7d3' => array(
'javelin-behavior', 'javelin-behavior',
'javelin-quicksand', 'javelin-quicksand',
@ -1464,12 +1470,6 @@ return array(
'owners-path-editor', 'owners-path-editor',
'javelin-behavior', 'javelin-behavior',
), ),
'7c492cd2' => array(
'javelin-install',
'javelin-dom',
'phuix-icon-view',
'phabricator-prefab',
),
'7cbe244b' => array( '7cbe244b' => array(
'javelin-install', 'javelin-install',
'javelin-util', 'javelin-util',

View file

@ -97,6 +97,15 @@ final class PhabricatorRemarkupControl extends AphrontFormTextAreaControl {
'headerIcon' => 'fa-smile-o', 'headerIcon' => 'fa-smile-o',
'headerText' => pht('Find Emoji:'), 'headerText' => pht('Find Emoji:'),
'hintText' => $emoji_datasource->getPlaceholderText(), 'hintText' => $emoji_datasource->getPlaceholderText(),
// Cancel on emoticons like ":3".
'ignore' => array(
'3',
')',
'(',
'-',
'/',
),
), ),
), ),
)); ));

View file

@ -343,6 +343,10 @@ JX.install('PHUIXAutocomplete', {
return [' ', ':', ',', '.', '!', '?']; return [' ', ':', ',', '.', '!', '?'];
}, },
_getIgnoreList: function() {
return this._map[this._active].ignore || [];
},
_isTerminatedString: function(string) { _isTerminatedString: function(string) {
var terminators = this._getTerminators(); var terminators = this._getTerminators();
for (var ii = 0; ii < terminators.length; ii++) { for (var ii = 0; ii < terminators.length; ii++) {
@ -517,6 +521,14 @@ JX.install('PHUIXAutocomplete', {
} }
} }
var ignore = this._getIgnoreList();
for (ii = 0; ii < ignore.length; ii++) {
if (trim.indexOf(ignore[ii]) === 0) {
this._deactivate();
return;
}
}
// If the input is terminated by a space or another word-terminating // If the input is terminated by a space or another word-terminating
// punctuation mark, we're going to deactivate if the results can not // punctuation mark, we're going to deactivate if the results can not
// be refined by addding more words. // be refined by addding more words.