Skip to content

Add cache expiry on avatar creation/removal

Ramya Authappan requested to merge github/fork/dblessing/issue-5496 into master

Created by: dblessing

This PR resolves #5496. If you add/remove an avatar the events cache is not updated and results in either a broken image or shows a gravatar instead of the avatar - see screenshots below. By adding a cache "expire/update" on both avatar creation/removal we can eliminate this issue. I took the approach of updating events by author id only and set it to limit to 1000 items. I'm not sure if this is the right limit or if a limit is warranted, but a similar cache reset for projects limits to 100 items. 100 seemed too low in this case because we have to expect that this user will have many events across multiple projects.

Steps to test (Please note that you cannot test this fix in a development environment without enabling caching)

  1. Add an avatar
  2. Go to the dashboard and note that the avatars on events are either still showing the gravatar or are showing a broken image link
  3. Apply this fix
  4. Change the avatar
  5. Go to the dashboard and note that the avatars are now showing the new image. Similarly, you can remove the avatar and note that gravatars are now shown on all events.

Illustration of the issue when an avatar is uploaded. You still see the gravatar/default avatar image: avatar_caching_issue

Illustration of the issue when a user already had an avatar and then changed it: avatar_caching_change

Merge request reports

Loading