Skip to:
Content

BuddyPress.org

Opened 8 years ago

Last modified 8 years ago

#7315 new defect (bug)

Autocomplete in messages produces bad html

Reported by: nhanser's profile 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)

#1 @hnla
8 years ago

Thanks for the heads up:
I too believed , as soon as I saw this, that we had fixed this once before:

Note 1 : the "closest('li')" thing was fixed (I saw tickets) in a previous version and was lost somewhere...

Having a quick check of this too.

#2 @hnla
8 years ago

We looked at this previously here:
#6820

#3 @hnla
8 years ago

Oddly we revert the change in r10447 in the subsequent r10634

This looks to have been for an issue with adding multiple recipients as mentioned?

Next question is is BP_Suggestion a thing?!

#4 @hnla
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

Last edited 8 years ago by hnla (previous) (diff)

#5 @DJPaul
8 years ago

  • Milestone changed from Awaiting Review to Future Release

We just need to properly implement Suggestions on that last screen so this nonsense can finally be put at rest.

Note: See TracTickets for help on using tickets.