Skip to:
Content

BuddyPress.org

Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#6445 closed defect (bug) (fixed)

Notifications: Invalidate cache when updating a notification

Reported by: r-a-y's profile r-a-y Owned by: johnjamesjacoby's profile johnjamesjacoby
Milestone: 2.3 Priority: normal
Severity: normal Version: 1.9
Component: Toolbar & Notifications Keywords: has-patch
Cc:

Description

If you're on your notifications page and you click on the "Read" action link for a notification, the user's notifications cache isn't invalidated.

Problem is due to not pulling up the user ID before updating the notification.

I've attached a patch with unit tests.

The patch adds a new hook - 'bp_notification_before_update' - which mirrors the other before_save and before_delete hooks and moves the cache clearing to bp-notifications-cache.php.

Attachments (1)

6445.01.patch (4.9 KB) - added by r-a-y 10 years ago.

Download all attachments as: .zip

Change History (6)

@r-a-y
10 years ago

#1 @DJPaul
10 years ago

  • Keywords early added

This ticket was mentioned in Slack in #buddypress by jjj. View the logs.


10 years ago

#3 @johnjamesjacoby
10 years ago

  • Keywords early removed
  • Milestone changed from 2.4 to 2.3
  • Owner set to johnjamesjacoby
  • Status changed from new to assigned

#4 @johnjamesjacoby
10 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 9887:

Notifications: Improve all_for_user cache deletion.

  • Introduce bp_notification_before_update action which fires before a Notification is updated
  • Introduce bp_notifications_clear_all_for_user_cache() as wrapper for wp_cache_delete() with appropriate cache group and key
  • Introduce bp_notifications_clear_all_for_user_cache_before_update() hooked to bp_notification_before_update action, to handle cache deletion before a notification is updated

This change fixes a bug where marking single notifications as read/unread would not show anticipated results, as the all_for_user cache was not being properly cleared.

Props r-a-y. Fixes #6445.

#5 @johnjamesjacoby
10 years ago

In 9888:

Notifications: Tests for all_for_user cache deletion.

Props r-a-y. See #6445. See r9887.

Note: See TracTickets for help on using tickets.