[buddypress-trac] [BuddyPress] #4779: messge compose autocompletefb.js splitting user name wrongly

buddypress-trac noreply at wordpress.org
Tue Jan 22 06:32:56 UTC 2013


#4779: messge compose autocompletefb.js splitting user name wrongly
--------------------------+-----------------------------
 Reporter:  mort3n        |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Messaging     |    Version:  1.6.1
 Severity:  normal        |   Keywords:
--------------------------+-----------------------------
 In
 {{{
 /bp-messages/js/autocomplete/jquery.autocompletefb.js
 }}}
 the user should be removed by

 {{{
 removeUsername: function(o){
 var newID = o.parentNode.id.split('-');
 jQuery('#send-to-usernames').removeClass(newID[1]);

 }}}
 The id being split contains the string 'un-user_name'. The code works
 great when 'user_name' contains no '-'. However, with
 {{{
 user_name = 'john-doe'
 }}}
 the code tries to remove class
 {{{
 john
 }}}
 which fails.
 Using a
 {{{
 -
 }}}
 seems to be valid in user names
 [http://codex.wordpress.org/Function_Reference/sanitize_user]

 A fix is
 {{{
 removeUsername: function(o){
 var newID = o.parentNode.id.substr(3);
 jQuery('#send-to-usernames').removeClass(newID);

 }}}
 Another fix is
 {{{
 removeUsername: function(o){
 var newID = o.parentNode.id.substr((o.parentNode.id.indexof('-'));
 jQuery('#send-to-usernames').removeClass(newID);

 }}}

-- 
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/4779>
BuddyPress <http://buddypress.org/>
BuddyPress


More information about the buddypress-trac mailing list