Opened 6 years ago
Closed 6 years ago
#8035 closed defect (bug) (fixed)
Nouveau: AJAX filter in Friends Requests returns incorrect and incorrectly-formatted results
Reported by: | oxibug | Owned by: | boonebgorges |
---|---|---|---|
Milestone: | 5.0.0 | Priority: | normal |
Severity: | major | Version: | 3.0.0 |
Component: | Friends | Keywords: | dev-feedback has-screenshots has-patch |
Cc: |
Description
Hi There!
WordPress 5.0.2 Multisite - Configured properly in wp-config
BuddyPress v4.1.0
bpDefaultData plugin to test - User Antawn
Theme: Twenty Seventeen
NOTE: This issue appears also in single sites
I noticed that my style corrupted in the Friends > Requests after using dropdown filter, and it doesn't happen in the Friends > Friendships So I took a screenshots for normal state and after using AJAX filter.
Issue: The main filter doesn't replace the main ul but it creates another ul inside it instead.
Attachments (3)
Change History (11)
#2
@
6 years ago
- Keywords has-patch added; needs-patch removed
- Milestone changed from Awaiting Review to 5.0.0
- Priority changed from omg pizza to normal
- Summary changed from Fatal mistake while using AJAX filter in Friends Requests to Nouveau: AJAX filter in Friends Requests returns incorrect and incorrectly-formatted results
- Version changed from 4.1.0 to 3.0.0
Hi @oxibug - Thanks for the ticket!
I see two issues:
- The incorrect results are being returned from the AJAX request. It's querying for all members instead of just friend requests.
- The structure of the post-AJAX markup is not correct (as you note in your screenshots)
It looks to me like this part of the interface may not have been fully reviewed when Nouveau was built - there's some copypasta from Legacy that doesn't totally work :) And, since Legacy doesn't support the 'filter' on /friends/requests, it's kinda broken in Nouveau too.
The attached patch fixes it, though I'd like a second look (from @imath perhaps?) to see if I'm following Nouveau conventions closely enough. The critical parts are:
- To fix the markup issues, I had to create a new
requests-loop
template. - That
requests-loop
template now usesbp_ajax_querystring()
, which lets the AJAX filters work. - To make the AJAX request fetch membership requests rather than all members, I had to do some customization of the
template
value sent in the AJAX request. I used group membership requests as a benchmark for this, but the case is slightly different here, since there's built-in logic in Groups to look atbp_current_action()
, but not in Members. Seebp_nouveau_current_object()
.
#3
@
6 years ago
Hi @boonebgorges !!
I'll have a look at the patch asap. But I think you forgot to attach it to the ticket :)
#5
@
6 years ago
😇 @boonebgorges I just gave it a look, it looks really nice. I haven't tested it yet. It's quite late for me tonight, but i will test it tomorrow for sure.
After this first look, I see a little improvement about template files inline docs. In the file you added, i think it would be better if it looked like :
/** * BuddyPress - Members Friends Requests Loop * * @since 5.0.0 * @version 5.0.0 */
And in the template file you edited, updating the version the template changed would be great :)
/** * BuddyPress - Members Friends Requests * * @since 3.0.0 * @version 5.0.0 */
I'll confirm tomorrow for the Ajax part. 😴
Friends Request AJAX filter issue