Skip to content

Commit 886011d

Browse files
committed
AO3-5512 Reduce cache busting
1 parent 4d27eb3 commit 886011d

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

app/models/media.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ class Media < Tag
44
has_many :common_taggings, as: :filterable
55
has_many :fandoms, -> { where(type: 'Fandom') }, through: :common_taggings, source: :common_tag
66

7-
after_save :expire_caches
7+
after_create :expire_caches
8+
after_update :expire_caches, if: -> { :saved_change_to_name? || :saved_change_to_type? }
89
after_destroy :expire_caches
910

1011
def expire_caches

features/tags_and_wrangling/tag_wrangling_media.feature

+30
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,36 @@ Feature: Media tags
134134
Then I should not see "Not a medium" within "#header .primary .dropdown .menu"
135135
And I should not see "Not a medium" within "#main .splash .browse"
136136

137+
Scenario: Renaming a media tag as admin changes it in the Fandoms header menu
138+
Given I have just created the canonical media tag "New Mediia Tag"
139+
And I am logged out
140+
# Make sure the old state gets cached
141+
And I go to the homepage
142+
Then I should see "New Mediia Tag" within "#header .primary .dropdown .menu"
143+
When I am logged in as a "tag_wrangling" admin
144+
And I edit the tag "New Mediia Tag"
145+
And I fill in "Name" with "New Media Tag"
146+
And I press "Save changes"
147+
Then I should see "Tag was updated."
148+
And I am logged out
149+
When I go to the homepage
150+
Then I should see "New Media Tag" within "#header .primary .dropdown .menu"
151+
152+
Scenario: Renaming a media tag as admin changes it in the Fandoms list on the homepage
153+
Given I have just created the canonical media tag "New Mediia Tag"
154+
And I am logged out
155+
# Make sure the old state gets cached
156+
And I go to the homepage
157+
Then I should see "New Mediia Tag" within "#main .splash .browse"
158+
When I am logged in as a "tag_wrangling" admin
159+
And I edit the tag "New Mediia Tag"
160+
And I fill in "Name" with "New Media Tag"
161+
And I press "Save changes"
162+
Then I should see "Tag was updated."
163+
And I am logged out
164+
When I go to the homepage
165+
Then I should see "New Media Tag" within "#main .splash .browse"
166+
137167
@javascript
138168
Scenario: Wranglers can add fandoms to new media tags
139169
Given I have just created the canonical media tag "New Media 5"

0 commit comments

Comments
 (0)