diff --git a/app/models/collection.rb b/app/models/collection.rb index ed78ea4ce3f..114ac1f469d 100755 --- a/app/models/collection.rb +++ b/app/models/collection.rb @@ -409,8 +409,13 @@ def clear_icon def self.expire_blurb_cache(id) # Expire both versions of the blurb, whether the user is logged in or not. %w[logged-in logged-out].each do |logged_in| - cache_key = "collection-blurb-#{logged_in}-#{id}-v5" - ActionController::Base.new.expire_fragment(cache_key) + [ + "collection-blurb-#{logged_in}-#{id}-v5-header", + "collection-blurb-#{logged_in}-#{id}-v5-summary", + "collection-blurb-#{logged_in}-#{id}-v5-body" + ].each do |cache_key| + ActionController::Base.new.expire_fragment(cache_key) + end end end diff --git a/app/views/collections/_collection_blurb.html.erb b/app/views/collections/_collection_blurb.html.erb index ea52c53003d..e3ccab86f58 100644 --- a/app/views/collections/_collection_blurb.html.erb +++ b/app/views/collections/_collection_blurb.html.erb @@ -1,7 +1,7 @@
  • <% logged_in = (logged_in_as_admin? || logged_in?) ? "logged-in" : "logged-out" %> - <%# remember to update Collection.expire_blurb_cache if you change this key %> - <% cache("collection-blurb-#{logged_in}-#{collection.id}-v5", expires_in: ArchiveConfig.MINUTES_UNTIL_COLLECTION_BLURBS_EXPIRE.minutes, skip_digest: true) do %> + <%# remember to update Collection.expire_blurb_cache if you change this key (or the similar summary and body keys below) %> + <% cache("collection-blurb-#{logged_in}-#{collection.id}-v5-header", expires_in: ArchiveConfig.MINUTES_UNTIL_COLLECTION_BLURBS_EXPIRE.minutes, skip_digest: true) do %>

    <%= link_to collection.title, collection_path(collection) %> @@ -21,17 +21,20 @@

    <% end %>
    + <% end %> - -
    <%= ts("Summary") %>
    -
    + +
    <%= t(".summary") %>
    +
    + <% cache("collection-blurb-#{logged_in}-#{collection.id}-v5-summary", expires_in: ArchiveConfig.MINUTES_UNTIL_COLLECTION_BLURBS_EXPIRE.minutes, skip_digest: true) do %> <%=raw strip_images(sanitize_field(collection, :description)) || " ".html_safe %> + <% end %> + <% if collection.challenge && collection.challenge.signup_open %> +

    <%= t(".signups_close_at") %> <%= time_in_zone(collection.challenge.signups_close_at, (collection.challenge.time_zone || Time.zone.name)) %>

    + <% end %> +
    - <% if collection.challenge && collection.challenge.signup_open %> -

    <%= ts("Sign-ups close at:") %> <%= time_in_zone(collection.challenge.signups_close_at, (collection.challenge.time_zone || Time.zone.name)) %>

    - <% end %> -
    - + <% cache("collection-blurb-#{logged_in}-#{collection.id}-v5-body", expires_in: ArchiveConfig.MINUTES_UNTIL_COLLECTION_BLURBS_EXPIRE.minutes, skip_digest: true) do %>

    (<%= collection.closed? ? ts("Closed") : ts("Open") %>, <%= collection.moderated? ? ts("Moderated") : ts("Unmoderated") %><%= collection.unrevealed? ? ts(", Unrevealed") : "" %><%= collection.anonymous? ? ts(", Anonymous") : "" %><%= collection.gift_exchange? ? ts(", Gift Exchange Challenge") : "" %><%= collection.prompt_meme? ? ts(", Prompt Meme Challenge") : "" %>)

    @@ -54,7 +57,7 @@ <% end %> - <% end %> + <% end %> <% if collection.user_is_owner?(current_user) || (collection.challenge && collection.challenge.signup_open && logged_in?) || (collection.moderated? && logged_in?) %>
    <%= ts("User Actions") %>
    diff --git a/config/locales/views/en.yml b/config/locales/views/en.yml index c2e3a15cd7a..7f42ac163e0 100644 --- a/config/locales/views/en.yml +++ b/config/locales/views/en.yml @@ -755,6 +755,8 @@ en: collections: collection_blurb: collection_tags: 'Collection Tags:' + signups_close_at: 'Sign-ups close at:' + summary: Summary filters: clear_filters: Clear Filters closed: diff --git a/features/prompt_memes_a/challenge_promptmeme_setup.feature b/features/prompt_memes_a/challenge_promptmeme_setup.feature index 822778bbded..e9791823435 100644 --- a/features/prompt_memes_a/challenge_promptmeme_setup.feature +++ b/features/prompt_memes_a/challenge_promptmeme_setup.feature @@ -22,6 +22,17 @@ Feature: Prompt Meme Challenge When I create Battle 12 promptmeme Then Battle 12 prompt meme should be correctly created + Scenario: Prompt meme timezone updates without caching + + Given I have Battle 12 prompt meme fully set up + And I am logged in as "scott" + When the user "scott" sets the time zone to "Nairobi" + And I go to the Collections page + Then I should see "EAT" within ".collection.picture.index.group .userstuff.summary" + When the user "scott" sets the time zone to "Mumbai" + And I go to the Collections page + Then I should see "IST" within ".collection.picture.index.group .userstuff.summary" + Scenario: User can see a prompt meme Given I have Battle 12 prompt meme fully set up