Opened 16 years ago
Last modified 9 years ago
#2239 new defect (bug)
if an activity is hidden from sitewide its children (comments) are not hidden as well
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Awaiting Contributions | Priority: | normal |
| Severity: | normal | Version: | |
| Component: | Activity | Keywords: | |
| Cc: | francescolaffi |
Description
I think there is no way to reproduce this from the front end, I found this problem adding and updating activities through a plugin, this is how to reproduce with some code:
- create an activity using bp_activity_add() and the argument hide_sitewide set to false.
- post some comments to that activity (comments inherit the hide_sitewide flag)
- update that activity using bp_activity_add(), this time the argument hide_sitewide set to true.
-result: the activity is hidden from sitewide but the hide_sitewide flag is not updated in its children, so the comments are not hidden
Change History (2)
Note: See
TracTickets for help on using
tickets.
I agree that it would be better to have this done automagically, but from looking at the code, I believe that everything is behaving exactly as intended. I'm still trying to fully grasp what's going on in this part of the code, but from what I can tell everything is as it should be. Until this functionality is purposed for the front end I'm guessing it's not going to get a whole lotta love. However, you can still get the hide_sitewide flag for the comment tree updated.
In your update function, you could do something like this:
// code leading up to bp_activity_add() bp_activity_add( $args ); // $child_comment_args would be an array/object filled with all your arguments if ( $child_comments = BP_Activity_Activity::get_child_comments( $parent_id ) { foreach ( $child_comments as $child_comment ) { // add check for existing child comment hide_sitewide value // if different, add new value to $child_comment_args bp_activity_add( $child_comment_args ); } }This is essentially the same thing that would be done if it were to be added to core.