Skip to:
Content

BuddyPress.org

Opened 4 years ago

Closed 3 years ago

#8296 closed defect (bug) (fixed)

`bp_activity_comments` cache should purge when an any child `activity_comment` is marked as spam

Reported by: oztaser's profile oztaser Owned by: imath's profile imath
Milestone: 10.0.0 Priority: normal
Severity: normal Version:
Component: Activity Keywords: has-patch has-unit-tests commit
Cc:

Description

We need to purge the parent activity bp_activity_comments cache when an activity comment marked as spam.

Steps to Reproduce:

  1. Enable object cache
  2. Add an activity comment to any activity
  3. Go to activity list page on admin
  4. Find an activity comment and marked as a spam
  5. Go back to activity page and see activity comment is still there

Attachments (3)

8296.patch (647 bytes) - added by oztaser 4 years ago.
8296.2.patch (2.6 KB) - added by imath 3 years ago.
8296.3.patch (10.6 KB) - added by imath 3 years ago.

Download all attachments as: .zip

Change History (9)

@oztaser
4 years ago

#1 @imath
3 years ago

  • Keywords reporter-feedback added

Hi @oztaser

I'm wondering, shouldn't we purge cache for any type of activity marked as spam ? Why restricting this to activity comment ?

#2 @oztaser
3 years ago

  • Keywords reporter-feedback removed

Hi @imath,

What I suggested here in this ticket is purging activity_comments cache. If you add activity comment to A activity and then mark as spam your activity comment, activity_comments cache of A activity needs to purge.

Based on your point we're already purging caches when activity marked as spam, If I don't missing something.

I took an another look at my patch, It does't look perfect :). We may purge $activity->item_id cache in bp_activity_mark_as_spam function.

@imath
3 years ago

#3 @imath
3 years ago

  • Keywords has-patch needs-unit-tests added
  • Milestone changed from Awaiting Review to 10.0.0

Hi @oztaser

Thanks for your explanations. I think we need to review how the bp_activity and bp_activity_comments cache are purge. Imho, when an activity is marked as spam/ham we should probably also purge the bp_activity cache if the activity is not an activity comment.

I also think we should take your patch in account, but avoid checking for is_spam as a comment content can simply be updated by the Administrator from the Activity Administration screen.

I'd feel more secure if we could build some unit tests about these purges.

I'd also like to get feedback about it from @r-a-y as he's been working on this area in the past.

Version 0, edited 3 years ago by imath (next)

#4 @oztaser
3 years ago

Hi @imath,

Thanks for your work. I totally agree with you and your patch looks good to me.

@imath
3 years ago

#5 @imath
3 years ago

  • Keywords has-unit-tests commit added; needs-unit-tests removed

8296.3.patch is including the Unit tests. I finally think it's safest to leave the bp_activity cache when an activity has been spam/ham.

#6 @imath
3 years ago

  • Owner set to imath
  • Resolution set to fixed
  • Status changed from new to closed

In 13149:

Improve the bp_activity_comments cache management

This cache should also be cleared when:

  • an activity comment has been marked as spam/ham.
  • an activity comment has been updated.

Props oztaser

Fixes #8296

Note: See TracTickets for help on using tickets.