Opened 8 years ago
Last modified 8 years ago
#7315 new defect (bug)
Autocomplete in messages produces bad html
Reported by: | N.Hans.er | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Contributions | Priority: | normal |
Severity: | minor | Version: | 2.7 |
Component: | Messages | Keywords: | needs-patch |
Cc: |
Description
First, it is my first ticket here.
I use the last version (2.7).
In compose.php file (members/single/messages), you have :
<ul class="first acfb-holder"> <li> <?php bp_message_get_recipient_tabs(); ?> <input type="text" name="send-to-input" class="send-to-input" id="send-to-input" /> </li> </ul>
where bp_message_get_recipient_tabs() produces nested <li></li> elements inside 'li' tag
Proposed changes :
<ul class="first acfb-holder"> <?php bp_message_get_recipient_tabs(); ?> <li> <input type="text" name="send-to-input" class="send-to-input" id="send-to-input" /> </li> </ul>
It is needed to change file 'bp-messages/js/autocomplete/jquery.autocompletefb.js' as :
/* Don't add the same user multiple times */ if( 0 === jQuery(settings.inputClass).closest('li').siblings('#un-' + un).length ) { var ln = '#link-' + un; var l = jQuery(ln).attr('href'); var v = '<li class="'+f+'" id="un-'+un+'"><span><a href="'+l+'">'+d[0]+'</a></span> <span class="p">X</span></li>'; var x = jQuery(settings.inputClass,tmp).closest('li').before(v); jQuery('#send-to-usernames').addClass(un); jQuery('.p',x[0].previousSibling).click(function(){ acfb.removeFind(this); }); }
It includes two modifications :
- first in the test to not have twice the same element
- add of 'li' element using "closest('li')"
By the way, I think the input should not be in the 'ul' to stay in place and not moving after 'li' of recipients
Note 1 : the "closest('li')" thing was fixed (I saw tickets) in a previous version and was lost somewhere...
Note 2 : I read somewhere that this autocomplete thing will be replace by "BP_Suggestion". I'm not familiar with it, but the change may be useless then.
Regards
Change History (5)
#4
@
8 years ago
Just tested sending a message to multiple recipients with the closest('li')
added back in and the markup/autocomplete worked as desired and the messages were sent/received without any issue so not sure really why we reverted.
But reading the reasons we got into this pickle on the ticket for the reversion helps #6935
Thanks for the heads up:
I too believed , as soon as I saw this, that we had fixed this once before:
Having a quick check of this too.