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 committed by Matchu
parent 1bf84b5106
commit cf2f78703b
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
@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,8 +92,7 @@
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
- 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)