Stop caching latest contribution

That's another tiny query that I'm okay with just removing the cache overhead complexity for right now!
This commit is contained in:
Matchu 2023-08-02 12:04:09 -07:00
parent 596c2a1320
commit c9e00f1d7c
3 changed files with 7 additions and 12 deletions

View file

@ -69,10 +69,8 @@ class OutfitsController < ApplicationController
@species_count = Species.count
unless localized_fragment_exist?('outfits#new latest_contribution')
@latest_contribution = Contribution.recent.first
Contribution.preload_contributeds_and_parents([@latest_contribution].compact)
end
@latest_contribution = Contribution.recent.first
Contribution.preload_contributeds_and_parents([@latest_contribution].compact)
@neopets_usernames = user_signed_in? ? current_user.neopets_usernames : []

View file

@ -2,8 +2,6 @@ class ContributionObserver < ActiveRecord::Observer
include FragmentExpiration
def after_create(contribution)
expire_fragment_in_all_locales('outfits#new latest_contribution')
if contribution.contributed_type == 'SwfAsset'
item = contribution.contributed.item
expire_fragment_in_all_locales("items/#{item.id} contributors")

View file

@ -92,12 +92,11 @@
required: true
= submit_tag t('.modeling_hub.load_pet.submit')
- localized_cache 'outfits#new latest_contribution' do
- if @latest_contribution # will be nil for a fresh copy of the site ;P
#latest-contribution
= link_to t('.latest_contribution.header'), contributions_path, :id => 'recent-contributions-link'
= latest_contribution_description(@latest_contribution)
%abbr#latest-contribution-created-at{:title => @latest_contribution.created_at.getutc.iso8601}
- if @latest_contribution # will be nil for a fresh copy of the site ;P
#latest-contribution
= link_to t('.latest_contribution.header'), contributions_path, :id => 'recent-contributions-link'
= latest_contribution_description(@latest_contribution)
%abbr#latest-contribution-created-at{:title => @latest_contribution.created_at.getutc.iso8601}
#whats-new
- if @newest_unmodeled_items.present?