Skip to:
Content

BuddyPress.org

Opened 10 years ago

Closed 10 years ago

Last modified 9 years ago

#6116 closed defect (bug) (fixed)

Message ajax search not working

Reported by: johnjamesjacoby's profile johnjamesjacoby Owned by: johnjamesjacoby's profile johnjamesjacoby
Milestone: 2.2 Priority: normal
Severity: normal Version:
Component: Messages Keywords: has-patch
Cc:

Description

Searching inbox and sentbox for messages no longer returns anticipated results. Instead it returns results as if no search string were passed.

Attachments (3)

6116.patch (752 bytes) - added by johnjamesjacoby 10 years ago.
6116.02.patch (796 bytes) - added by r-a-y 10 years ago.
6116-03.patch (1008 bytes) - added by hnla 10 years ago.
Add additional form submit 'type' check

Download all attachments as: .zip

Change History (18)

#1 @johnjamesjacoby
10 years ago

  • Keywords has-patch 2nd-opinion added; needs-patch removed

#2 @johnjamesjacoby
10 years ago

Looks like the markup in bp_message_search_form() either changed before 2012, or was never correct and this never worked via ajax like #3993 and r5822 conveyed.

Last edited 10 years ago by johnjamesjacoby (previous) (diff)

#3 @johnjamesjacoby
10 years ago

r5822 looks fine, but not seeing the changeset where the input was pulled out of the label. Maybe this just happened as part of the bp-legacy move?

Last edited 10 years ago by johnjamesjacoby (previous) (diff)

#4 follow-up: @r-a-y
10 years ago

r9240 broke this to address #6010.

For the patch, I would suggest jq('#messages_search').val() instead of target.parent().children('input[type="text"]').val().

Selector by ID is a faster search than traversing through the DOM.

Btw, nice catch!

Last edited 10 years ago by r-a-y (previous) (diff)

@r-a-y
10 years ago

#5 @hnla
10 years ago

Noticed this issue yesterday when running through messages and adding that filter, meant to mention/ticket it but got lost in the moment.

I'll apply the patch and test in a minute.

#6 @hnla
10 years ago

Tested -02 patch which appears to work fine search returns correctly now. I have a problem though in having to filter this markup to add additional elements for styling, while retaining unchanged the original form markup and tokens however with that filtered in the search is again broken, so possibly the JS selectors are too specific i.e is a direct child of something or - and I have a suspicion that filtering these search functions might be upsetting Ajax somehow? Looking into what is going wrong currently with my markup.

#7 follow-up: @hnla
10 years ago

So my particular problem is in having to use the 'button' element; in our initial check we test for 'type' === 'submit' I've added a check for 'button' and tested as working.
Patch uploaded.

@hnla
10 years ago

Add additional form submit 'type' check

#8 in reply to: ↑ 4 @johnjamesjacoby
10 years ago

Replying to r-a-y:

r9240 broke this to address #6010.

For the patch, I would suggest jq('#messages_search').val() instead of target.parent().children('input[type="text"]').val().

This makes more sense to me. I don't love the idea of making a bunch of assumptions about random ID's in the DOM, but it does work, is the fastest, and mirrors our existing JS approaches elsewhere.

Tangentially, anyone want to create a ticket to come up with a DOM element ID paradigm we should be adhering to and cleaning up existing code against?

#9 in reply to: ↑ 7 @johnjamesjacoby
10 years ago

Replying to hnla:

So my particular problem is in having to use the 'button' element; in our initial check we test for 'type' === 'submit' I've added a check for 'button' and tested as working.
Patch uploaded.

I like the idea of checking for button also. We should be using the button element more for our forms where literal buttons are the norm.

#10 @r-a-y
10 years ago

  • Keywords 2nd-opinion removed

03.patch is good to go in my eyes.

Thanks for testing, hnla, and for your button check addition.

#11 @hnla
10 years ago

This makes more sense to me. I don't love the idea of making a bunch of assumptions about random ID's in the DOM, but it does work, is the fastest, and mirrors our existing JS approaches elsewhere.

We did do a lot of work trawling through the file removing many vague 'have a look around and gather up any tokens you might find' .parent approaches in favour of .closest and also removed a tonne of too strictly binding selectors and tokens, problem with .parent is it has to traverse all the way to the top of the DOM then cache the whole damned lot so is hugely expensive.

#12 @johnjamesjacoby
10 years ago

  • Owner set to johnjamesjacoby
  • Resolution set to fixed
  • Status changed from new to closed

In 9353:

Ajax search in private message inbox/sentbox has been broken since r9240. We fix it here by modifying the JS in bp-legacy to accommodate both DOM scenarios, and include the option of using button instead of input (which can likely happen in other areas over time, also.)

Props r-a-y, hnla. Fixes #6116.

#13 @vizzweb
9 years ago

Hi!

My code is the updated one but still search is not working. Any help?

#14 @vizzweb
9 years ago

Hi!

Any one can help on ajax search message issue?

I have the updated code but the ajax is returning all the messages. The text that i have to search is not working.

Thanks

#15 @hnla
9 years ago

@vizzweb You'll be best off opening a support thread in the BP forums (if you haven't already), and provide a lot more detail about your setup and how your are searching or have updated - this is a close trac ticket so won't receive a lot of attention.

If it does prove to be an issue with messaging we'll open a new trac ticket to address the issue.

Note: See TracTickets for help on using tickets.