Opened 10 years ago
Closed 10 years ago
#5779 closed defect (bug) (fixed)
Ajax & searching in Activities, focusing on Activity Heartbeat feature
Reported by: | imath | Owned by: | imath |
---|---|---|---|
Milestone: | 2.1 | Priority: | normal |
Severity: | normal | Version: | 2.0 |
Component: | Activity | Keywords: | good-first-bug has-patch commit |
Cc: |
Description
In a comment to #5505, SGr33n reported a problem with the activity Heartbeat feature (load newest) & searching activities. I confirm this problem : if you add ?s=random
it will load all newest activities without taking in account the search.
First, SGr33n, can you confirm that when you say: 'search page', we are talking about site.url/activity/?s=random
. Or is it a plugin that is creating a specific search feature ?
Second, i'm hesitating about search. As the "Load More" feature doesn't support search neither, my first idea was to neutralize "load newest" if we have a ?s=random
query string: see the ticketnumber
.heartbeat-nosearch.patch. Using this patch, we get rid of the bug.
Then i thought it's a bit too bad, and i've built ticketnumber
.heartbeat-search.patch which will load newest activities if they match the search_terms.
Finally, i thought it's a bit more too bad to support search in activity heartbeat and not in "load more", so i've build a 3rd patch : ticketnumber
.loadmore-search.patch.
So i think we have 2 options :
- neutralize activity heartbeat if a search is performed >
ticketnumber
.heartbeat-nosearch.patch, or - support search in activity heartbeat and load more features >
ticketnumber
.heartbeat-search.patch +ticketnumber
.loadmore-search.patch
What do you think ?
Attachments (4)
Change History (13)
#1
in reply to:
↑ description
@
10 years ago
#2
@
10 years ago
Second option seems better to me (support search for heartbeat and for Load More). Implementation seems straightforward, and it seems like it fixes an existing bug (that search terms are ignored on Load More)
#5
@
10 years ago
- Keywords needs-patch added; has-patch reporter-feedback 2nd-opinion removed
In 5779.heartbeat-search.patch, I don't think esc_html
is the right function to use to sanitise the user input.
#6
@
10 years ago
- Keywords good-first-bug added
Ticket update:
- 5779.heartbeat-search.patch needs updating (replace
esc_html
with an appropriate sanitisation function). - 5779.loadmore-search.patch is ready for commit.
#7
@
10 years ago
- Keywords has-patch added; needs-patch removed
I suggest 5779.02.patch which is merging 5779.heartbeat-search.patch and 5779.loadmore-search.patch.
It uses addslashes
instead of esc_html
. Tested searching for "l'apostrophe" for instance and it seems to be ok on the two features.
At the end in BP_Activity_Activity::get(), search_terms are escaped using bp_esc_like()
Confirmed
Seems a good option, also in a semantic view, since that if you are searching somenthing, means that this something was already published... maybe this ticket will be updated when BuddyPress will support hashtags.
In my opinion, you can disable it on the search page :)