Opened 7 years ago
Closed 7 years ago
#7795 closed defect (bug) (fixed)
BP Nouveau: restrict Messages UI editor buttons and allowed tags.
Reported by: | imath | Owned by: | imath |
---|---|---|---|
Milestone: | 3.0 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Templates | Keywords: | has-patch commit |
Cc: |
Description
Today the Messages UI editor loads default buttons, and allows the same tags than WordPress Posts. I think we should restrict this a little more.
NB: conparing to the src/bp-messages/bp-messages-filters.php
where wp_filter_kses
is used, i suggest something more permissive (eg: img) to justify the use of the editor.
I think as it's specific to BP Nouveau, we shouldn't edit src/bp-messages/bp-messages-filters.php
to avoid possible impacts on BP Legacy so close to release though.
See attached patch, I'm basically allowing the same html tags than Activity content
Attachments (3)
Change History (14)
#2
@
7 years ago
The idea was to improve the user experience when writing messages.
And yes you're right about the rest of BuddyPress and Legacy. Another option can be to remove the editor completely and stay with existing way of filtering the content.
I'm fine with both options ;)
#3
@
7 years ago
Why make it in Nouveau, only, and not in BuddyPress core? Messing about with the sanitisation filters suggests something has been done wrong.
I think we need to remove lines 106-119 in https://buddypress.trac.wordpress.org/browser/trunk/src/bp-templates/bp-nouveau/includes/messages/loader.php#L106 and set those filters in bp-messages/filters.php (whatever the file is called, etc).
#4
@
7 years ago
We can keep the TinyMCE in Nouveau only, that's fine, but if we're enhancing private messages to support HTML, let's do that in BuddyPress, proper.
#6
@
7 years ago
I like it, much better, thanks.
Where did you get the whitelist of allowed HTML attributes from, by the way?
#7
@
7 years ago
yw :) From bp_activity_filter_kses()
. Do you think having a bp_core_filter_kses()
that would be used for activity and messages content would be a better idea to avoid duplicate code ?
#8
@
7 years ago
7795.3.patch introduces bp_get_allowedtags()
that bp_activity_filter_kses()
and bp_messages_filter_kses()
are using to filter their activity/message content. Both of the functions are including a filter bp_
[component]_allowed_tags
in case developers want to extend one or the other or both.
Why is Nouveau allowing HTML in this panel? I assume the rest of BuddyPress and/or Legacy isn't?