forked from OpenNeo/impress
Stop caching item page contributors
This lets us remove the contribution observer too!
This commit is contained in:
parent
f277ad9ffd
commit
99910aff6a
4 changed files with 9 additions and 23 deletions
|
@ -65,9 +65,7 @@ class ItemsController < ApplicationController
|
||||||
scope: Zone.includes_translations.alphabetical
|
scope: Zone.includes_translations.alphabetical
|
||||||
)
|
)
|
||||||
|
|
||||||
unless localized_fragment_exist?("items/#{@item.id} contributors")
|
@contributors_with_counts = @item.contributors_with_counts
|
||||||
@contributors_with_counts = @item.contributors_with_counts
|
|
||||||
end
|
|
||||||
|
|
||||||
@supported_species_ids = @item.supported_species_ids
|
@supported_species_ids = @item.supported_species_ids
|
||||||
unless localized_fragment_exist?("items/show standard_species_images special_color=#{@item.special_color_id}")
|
unless localized_fragment_exist?("items/show standard_species_images special_color=#{@item.special_color_id}")
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
class ContributionObserver < ActiveRecord::Observer
|
|
||||||
include FragmentExpiration
|
|
||||||
|
|
||||||
def after_create(contribution)
|
|
||||||
if contribution.contributed_type == 'SwfAsset'
|
|
||||||
item = contribution.contributed.item
|
|
||||||
expire_fragment_in_all_locales("items/#{item.id} contributors")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -84,14 +84,13 @@
|
||||||
#item-preview-error
|
#item-preview-error
|
||||||
#item-preview-swf= t '.preview.requirements_not_met'
|
#item-preview-swf= t '.preview.requirements_not_met'
|
||||||
|
|
||||||
- localized_cache "items/#{@item.id} contributors" do
|
- unless @contributors_with_counts.empty?
|
||||||
- unless @contributors_with_counts.empty?
|
#item-contributors
|
||||||
#item-contributors
|
%header #{t '.contributors.header'}:
|
||||||
%header #{t '.contributors.header'}:
|
%ul
|
||||||
%ul
|
- @contributors_with_counts.each do |contributor, count|
|
||||||
- @contributors_with_counts.each do |contributor, count|
|
%li= link_to(contributor.name, user_contributions_path(contributor)) + format_contribution_count(count)
|
||||||
%li= link_to(contributor.name, user_contributions_path(contributor)) + format_contribution_count(count)
|
%footer= t '.contributors.footer'
|
||||||
%footer= t '.contributors.footer'
|
|
||||||
|
|
||||||
:javascript
|
:javascript
|
||||||
var CURRENT_ITEM_ZONES_RESTRICT = #{@item.zones_restrict.inspect},
|
var CURRENT_ITEM_ZONES_RESTRICT = #{@item.zones_restrict.inspect},
|
||||||
|
|
|
@ -14,8 +14,7 @@ module OpenneoImpressItems
|
||||||
|
|
||||||
# Activate observers that should always be running
|
# Activate observers that should always be running
|
||||||
config.active_record.observers = [:closet_hanger_observer,
|
config.active_record.observers = [:closet_hanger_observer,
|
||||||
:closet_list_observer, :contribution_observer,
|
:closet_list_observer, :pet_type_observer, :user_sweeper]
|
||||||
:pet_type_observer, :user_sweeper]
|
|
||||||
|
|
||||||
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
||||||
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
||||||
|
|
Loading…
Reference in a new issue