Skip to content

Commit

Permalink
AO3-6058 Make sure download URLS update
Browse files Browse the repository at this point in the history
  • Loading branch information
weeklies committed Aug 17, 2023
1 parent a190a0a commit eb86565
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion app/models/work.rb
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ def new_recipients_allow_gifts
after_save :moderate_spam
after_save :notify_of_hiding

after_save :notify_recipients, :expire_caches, :update_pseud_index, :update_tag_index, :touch_series
after_save :notify_recipients, :expire_caches, :update_pseud_index, :update_tag_index, :touch_series, :touch_related_works
after_destroy :expire_caches, :update_pseud_index

before_destroy :send_deleted_work_notification, prepend: true
Expand Down Expand Up @@ -923,6 +923,14 @@ def parents_after_saving
parent_work_relationships.reject(&:marked_for_destruction?)
end

def touch_related_works
return unless saved_change_to_in_unrevealed_collection?

# Make sure download URLs of child and parent works expire to preserve anonymity.
children.touch_all
parents_after_saving.each { |rw| rw.parent.touch }
end

#################################################################################
#
# In this section we define various named scopes that can be chained together
Expand Down

0 comments on commit eb86565

Please sign in to comment.