Last Comment Bug 641519 - userAutocomplete is not compatible with Bugzilla configured to use "local" usernames
: userAutocomplete is not compatible with Bugzilla configured to use "local" us...
Status: RESOLVED FIXED
:
Product: Bugzilla
Classification: Server Software
Component: Creating/Changing Bugs (show other bugs)
: 4.0
: All All
: -- normal (vote)
: Bugzilla 4.0
Assigned To: Randy Reddekopp
: default-qa
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-03-14 08:49 PDT by Randy Reddekopp
Modified: 2011-04-19 06:28 PDT (History)
1 user (show)
mkanat: approval+
mkanat: approval4.0+
LpSolit: blocking4.0.1+
mkanat: testcase?
See Also:
QA Whiteboard:
Iteration: ---
Points: ---


Attachments
Patch applied to js/field.js to fix bug (1.17 KB, patch)
2011-03-14 08:59 PDT, Randy Reddekopp
mkanat: review+
Details | Diff | Splinter Review
Patch to apply to js/field.js (1.15 KB, patch)
2011-04-06 14:17 PDT, Randy Reddekopp
mkanat: review+
Details | Diff | Splinter Review

Description Randy Reddekopp 2011-03-14 08:49:41 PDT
User-Agent:       Mozilla/5.0 (X11; Linux i686 on x86_64; rv:2.0b11) Gecko/20100101 Firefox/4.0b11
Build Identifier: 4.0.0

Having bugzilla configured to use local usernames implies that the user accounts created have a username without an email suffix (such as @hotmail.com)

Following recommendations, our company uses the following settings to achieve this configuration:

Administration > Parameters > User Authentication:
emailregexp = ^[^@]+
emailsuffix = @ourcompanydomain.ca
createemailregexp = .*

Now when using any field which makes use of the "userAutocomplete" functionality, the full username + email suffix is returned when a user is selected from the resulting list.  Next when one attempts to "Save Changes" an error is returned something like:
"Assignee: username@companyDomain.ca did not match anything"

In the code there are two values used, "email" and "real_name", the first of which is used on selection.  I recommend that "email" be replaced with "name".  "name" will actually return an email address if bugzilla uses the default configuration, where-as "name" will return the correct username as well if bugzilla is setup to use local usernames.

I will attach a patch in a following post

Reproducible: Always

Steps to Reproduce:
1. Configure bugzilla to use local usernames
2. Fill out a userAutocomplete field in some random Bug (such as changing Assignee, QA Contact, or appending a user to the CC list)
3. Attempt to "Save Changes"
Actual Results:  
Assignee/QA Contact: user@address.com did not match anything

Expected Results:  
Bug change successful
Comment 1 Randy Reddekopp 2011-03-14 08:59:03 PDT
Created attachment 519155 [details] [diff] [review]
Patch applied to js/field.js to fix bug

Here is the patch I applied to my system to fix the bug.
Comment 2 Max Kanat-Alexander 2011-03-14 15:23:44 PDT
Comment on attachment 519155 [details] [diff] [review]
Patch applied to js/field.js to fix bug

Ah yes, that looks right! Thank you!! :-)
Comment 3 Max Kanat-Alexander 2011-03-14 15:24:19 PDT
It would be nice to do some testing with emailsuffix, I think a lot of people use it.
Comment 4 Frédéric Buclin 2011-03-26 15:34:16 PDT
This patch doesn't apply cleanly, neither on trunk nor on the 4.0 branch, probably due to bug 619637:

Hunk #3 FAILED at 693.

Updated patch needed.
Comment 5 Max Kanat-Alexander 2011-04-04 17:06:33 PDT
Hey Randy. Could we get a patch that applies to the trunk?
Comment 6 Randy Reddekopp 2011-04-04 19:18:06 PDT
Max and Frédéric, sorry I have been super busy at work (others were laid off), I will work on uploading a new patch for the trunk tomorrow.
Comment 7 Max Kanat-Alexander 2011-04-04 19:24:12 PDT
(In reply to comment #6)
> Max and Frédéric, sorry I have been super busy at work (others were laid off),
> I will work on uploading a new patch for the trunk tomorrow.

  Sounds great, thanks! No problem on the delay, I totally understand.
Comment 8 Randy Reddekopp 2011-04-06 14:17:37 PDT
Created attachment 524261 [details] [diff] [review]
Patch to apply to js/field.js

Here is the new patch that should work with the trunk.  Note: I have not done any testing of this yet.  If I have time I will try to later today.  The patch should work on the trunk as of today.

P.S. I have never worked with Bazaar before, I should look into this a bit more, seems like a nice tool (from what I have used checking out the trunk).
Comment 9 Max Kanat-Alexander 2011-04-07 16:30:57 PDT
Comment on attachment 524261 [details] [diff] [review]
Patch to apply to js/field.js

Looks good to me.
Comment 10 Max Kanat-Alexander 2011-04-07 16:31:37 PDT
(In reply to comment #8)
> P.S. I have never worked with Bazaar before, I should look into this a bit
> more, seems like a nice tool (from what I have used checking out the trunk).

  Cool! Yeah, it's my favorite distributed version control system out of all of them.
Comment 11 Frédéric Buclin 2011-04-19 06:28:05 PDT
Committing to: bzr+ssh://lpsolit%40gmail.com@bzr.mozilla.org/bugzilla/trunk/
modified js/field.js
Committed revision 7777.

Committing to: bzr+ssh://lpsolit%40gmail.com@bzr.mozilla.org/bugzilla/4.0/
modified js/field.js
Committed revision 7570.

Note You need to log in before you can comment on or make changes to this bug.