@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Disable tokenizer "Browse" button once tokenizer is full

Summary: Ref T7858. Don't let users add multiple values to single-value tokenizers by using the "Browse" button.

Test Plan:
- Added a token, browse button was disabled.
- Removed the token, browse button was enabled again.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T7858

Differential Revision: https://secure.phabricator.com/D14738

+38 -10
+9 -9
resources/celerity/map.php
··· 8 8 return array( 9 9 'names' => array( 10 10 'core.pkg.css' => '6d8c526d', 11 - 'core.pkg.js' => '3c0f7f9b', 11 + 'core.pkg.js' => '46bc8dbd', 12 12 'darkconsole.pkg.js' => 'e7393ebb', 13 13 'differential.pkg.css' => '2de124c9', 14 14 'differential.pkg.js' => '6223dd9d', ··· 244 244 'rsrc/externals/javelin/lib/__tests__/URI.js' => '1e45fda9', 245 245 'rsrc/externals/javelin/lib/__tests__/behavior.js' => '1ea62783', 246 246 'rsrc/externals/javelin/lib/behavior.js' => '61cbc29a', 247 - 'rsrc/externals/javelin/lib/control/tokenizer/Tokenizer.js' => 'ab5f468d', 247 + 'rsrc/externals/javelin/lib/control/tokenizer/Tokenizer.js' => '9fef18a5', 248 248 'rsrc/externals/javelin/lib/control/typeahead/Typeahead.js' => '70baed2f', 249 249 'rsrc/externals/javelin/lib/control/typeahead/normalizer/TypeaheadNormalizer.js' => 'e6e25838', 250 250 'rsrc/externals/javelin/lib/control/typeahead/source/TypeaheadCompositeSource.js' => '503e17fd', ··· 704 704 'javelin-scrollbar' => '087e919c', 705 705 'javelin-sound' => '949c0fe5', 706 706 'javelin-stratcom' => '6c53634d', 707 - 'javelin-tokenizer' => 'ab5f468d', 707 + 'javelin-tokenizer' => '9fef18a5', 708 708 'javelin-typeahead' => '70baed2f', 709 709 'javelin-typeahead-composite-source' => '503e17fd', 710 710 'javelin-typeahead-normalizer' => 'e6e25838', ··· 1581 1581 'javelin-dom', 1582 1582 'javelin-vector', 1583 1583 ), 1584 + '9fef18a5' => array( 1585 + 'javelin-dom', 1586 + 'javelin-util', 1587 + 'javelin-stratcom', 1588 + 'javelin-install', 1589 + ), 1584 1590 'a0b57eb8' => array( 1585 1591 'javelin-behavior', 1586 1592 'javelin-dom', ··· 1657 1663 'javelin-dom', 1658 1664 'javelin-util', 1659 1665 'phabricator-prefab', 1660 - ), 1661 - 'ab5f468d' => array( 1662 - 'javelin-dom', 1663 - 'javelin-util', 1664 - 'javelin-stratcom', 1665 - 'javelin-install', 1666 1666 ), 1667 1667 'ad10aeac' => array( 1668 1668 'javelin-install',
+29 -1
webroot/rsrc/externals/javelin/lib/control/tokenizer/Tokenizer.js
··· 313 313 314 314 root.insertBefore(token, focus); 315 315 316 - this.invoke('change', this); 316 + this._didChangeValue(); 317 317 318 318 return true; 319 319 }, ··· 419 419 this._redraw(true); 420 420 focus && this.focus(); 421 421 422 + this._didChangeValue(); 423 + 424 + return true; 425 + }, 426 + 427 + _didChangeValue: function() { 428 + 429 + if (this.getBrowseURI()) { 430 + var button = JX.DOM.find(this._frame, 'a', 'tokenizer-browse'); 431 + JX.DOM.alterClass(button, 'disabled', !!this._isAtTokenLimit()); 432 + } 433 + 422 434 this.invoke('change', this); 435 + }, 436 + 437 + _isAtTokenLimit: function() { 438 + var limit = this.getLimit(); 439 + 440 + if (!limit) { 441 + return false; 442 + } 443 + 444 + if (limit > JX.keys(this.getTokens()).length) { 445 + return false; 446 + } 423 447 424 448 return true; 425 449 }, ··· 459 483 460 484 var uri = this.getBrowseURI(); 461 485 if (!uri) { 486 + return; 487 + } 488 + 489 + if (this._isAtTokenLimit()) { 462 490 return; 463 491 } 464 492