Commit 5dd92056d11448c712ca122399d1af4b3e85e2f5

Authored by Daniela Feitosa
Committed by Antonio Terceiro
1 parent 0a7c5853

ActionItem990: fixing bug: after removing friend, friends list was crashing

* fixing plugin to accept regexp
  * fixing sweeper to use timeout
app/sweepers/friendship_sweeper.rb
... ... @@ -19,7 +19,7 @@ protected
19 19 def expire_cache(profile)
20 20 [profile.friends_cache_key, profile.manage_friends_cache_key].each { |ck|
21 21 cache_key = ck.gsub(/(.)-\d.*$/, '\1')
22   - expire_fragment(/#{cache_key}/)
  22 + expire_timeout_fragment(/#{cache_key}/)
23 23 }
24 24  
25 25 blocks = profile.blocks.select{|b| b.kind_of?(FriendsBlock)}
... ...
app/views/profile/communities.rhtml
... ... @@ -3,7 +3,7 @@
3 3  
4 4 <h1><%= _("%s's communities") % profile.name %></h1>
5 5  
6   -<% cache(profile.communities_cache_key(params)) do %>
  6 +<% cache_timeout(profile.communities_cache_key(params), 4.hour.from_now) do %>
7 7 <ul class='profile-list'>
8 8 <% @communities.each do |community| %>
9 9 <li><%= profile_image_link(community)%></li>
... ...
vendor/plugins/timed_cached_fragment/lib/timed_cache_fragment.rb
... ... @@ -16,7 +16,9 @@ module ActionController
16 16 end
17 17 #handles the expiration of timeout fragment
18 18 def expire_timeout_fragment(key)
19   - @@cache_timeout_values[key] = nil
  19 + @@cache_timeout_values.keys.select{|k| key === k}.each do |k|
  20 + @@cache_timeout_values[k] = nil
  21 + end
20 22 expire_fragment(/#{key}/)
21 23 end
22 24 #checks to see if a cache has fully expired
... ...