Opened 6 years ago
Closed 6 years ago
#7951 closed defect (bug) (fixed)
Nouveau: bp_get_suggestions 400 error when activity component is disabled
Reported by: | shubh14 | Owned by: | boonebgorges |
---|---|---|---|
Milestone: | 4.0 | Priority: | normal |
Severity: | normal | Version: | 3.0.0 |
Component: | Templates | Keywords: | has-patch 2nd-opinion |
Cc: |
Description
Hi,
I am getting the 400 error when I type in a @username to send a private message when the activity component is disabled. The exact error is:
Failed to load resource: the server responded with a status of 400 () /wp-admin/admin-ajax.php?action=bp_get_suggestions&term=arun&type=members
Wordpress: 4.9.8
Buddypress: 3.1.0
Theme: Nouveau
Attachments (3)
Change History (10)
#1
@
6 years ago
- Component changed from Messages to Templates
- Keywords has-patch added
- Milestone changed from Awaiting Review to 3.3.0
- Summary changed from bp_get_suggestions 400 error when activity component is disabled to Nouveau: bp_get_suggestions 400 error when activity component is disabled
#2
@
6 years ago
- Keywords 2nd-opinion added
Thanks for the ping @r-a-y I think a better fix would be to make sure the bp_ajax_get_suggestions()
is available even if the activity component is not active, otherwise it's not possible to autocomplete usernames in the message compose UI.
I'd probably move this function into bp-core/bp-core-functions.php
just after the bp_core_get_suggestions()
one. As i don't see any functions needing the bp-activity/bp-activity-functions.php
to be loaded into bp_ajax_get_suggestions()
, I think there's no problem doing so.
@DJPaul what do you think ?
#3
@
6 years ago
It makes sense that bp_ajax_get_suggestions()
should be moved to core since bp_core_get_suggestions()
is already apart of core.
It might also make sense to register the mentions JS in core as well. That way, the Activity component or Nouveau can enqueue it when it wants. Right now, Nouveau has to manually re-enqueue it.
#4
@
6 years ago
The Suggestions stuff was architectured to support more than what we've used it for. Recall that BP_Groups_Member_Suggestions
exists in/for the Groups component.
Ray's patch looks a good approach. I like that Mathieu's patch also checks to see if the global variable is present. I like these combined.
Ray's idea about registering this in bp_core_register_common_scripts()
-- that makes sense, but let's not re-arrange any related existing wp_enqueue_script
call apart from the duplication in the Nouveau templates.
Confirmed.
The problem is the mentions script is always loaded without checking if the Activity component is active or not.
01.patch
is a potential fix for this. @imath, can you take a look when you have a chance?