From ccd6770a098fd3969d90e47a9e16ff690fe6b9f6 Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 23 Apr 2015 06:15:06 -0700 Subject: [PATCH] Fix an issue where "Browse > Select" did not work for dynamic tokenizers Summary: Ref T4100. In Herald, using the browse dialog to select a result didn't work because we'd add the token with no name value. Other things would render it elsewhere, but it would eventaully be discarded. Instead, add it with a name value. Test Plan: Edited a Herald rule and used Browse > Select to add a token. Saved rule. Saw token persist. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T4100 Differential Revision: https://secure.phabricator.com/D12529 --- .../externals/javelin/lib/control/tokenizer/Tokenizer.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/webroot/rsrc/externals/javelin/lib/control/tokenizer/Tokenizer.js b/webroot/rsrc/externals/javelin/lib/control/tokenizer/Tokenizer.js index 60f7df8063..b626f9fc73 100644 --- a/webroot/rsrc/externals/javelin/lib/control/tokenizer/Tokenizer.js +++ b/webroot/rsrc/externals/javelin/lib/control/tokenizer/Tokenizer.js @@ -465,8 +465,12 @@ JX.install('Tokenizer', { new JX.Workflow(uri, {exclude: JX.keys(this.getTokens()).join(',')}) .setHandler( JX.bind(this, function(r) { - this._typeahead.getDatasource().addResult(r.token); - this.addToken(r.key); + var source = this._typeahead.getDatasource(); + + source.addResult(r.token); + var result = source.getResult(r.key); + + this.addToken(r.key, result.name); this.focus(); })) .start();