Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepend before_destroy(s) in models with destroy dependents #4191

Merged
merged 1 commit into from
Oct 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prepend before_destroy(s) in models with destroy dependents
  • Loading branch information
rhymes committed Oct 2, 2019
commit 3871760e332d8da375f53bd9963a2182200f472d
2 changes: 1 addition & 1 deletion app/models/article.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class Article < ApplicationRecord
after_save :detect_human_language
before_save :update_cached_user
after_update :update_notifications, if: proc { |article| article.notifications.any? && !article.saved_changes.empty? }
before_destroy :before_destroy_actions
before_destroy :before_destroy_actions, prepend: true

serialize :ids_for_suggested_articles
serialize :cached_user
Expand Down
2 changes: 1 addition & 1 deletion app/models/chat_channel.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class ChatChannel < ApplicationRecord
ranking ["desc(last_message_at)"]
end

before_destroy :remove_from_index!
before_destroy :remove_from_index!, prepend: true

def open?
channel_type == "open"
Expand Down
8 changes: 4 additions & 4 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,10 @@ class User < ApplicationRecord
before_validation :set_config_input
before_validation :downcase_email
before_validation :check_for_username_change
before_destroy :remove_from_algolia_index
before_destroy :destroy_empty_dm_channels
before_destroy :destroy_follows
before_destroy :unsubscribe_from_newsletters
before_destroy :remove_from_algolia_index, prepend: true
before_destroy :destroy_empty_dm_channels, prepend: true
before_destroy :destroy_follows, prepend: true
before_destroy :unsubscribe_from_newsletters, prepend: true

algoliasearch per_environment: true, enqueue: :trigger_delayed_index do
attribute :name
Expand Down