gitlabhq/gitlabhq — pull request #5759 by bke-drewb (2013-12-04 16:48:36+00:00)
Title: Add cache expiry on avatar creation/removal

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](https://f.cloud.github.com/assets/2394772/1675065/603eea22-5d03-11e3-97c7-f6ff98600a68.png)

Illustration of the issue when a user already had an avatar and then changed it:
![avatar_caching_change](https://f.cloud.github.com/assets/2394772/1675078/945dfbe0-5d03-11e3-8b62-5b5f137a67aa.png)