Skip to content

Commit

Permalink
Alert on condition disable; closes #307
Browse files Browse the repository at this point in the history
  • Loading branch information
ArtOfCode- committed Feb 13, 2018
1 parent 4504f83 commit 46d925d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/models/flag_condition.rb
Expand Up @@ -29,8 +29,12 @@ def accuracy_and_post_count
def self.revalidate_all
FlagCondition.where(flags_enabled: true).find_each do |fc|
unless fc.validate
failures = fc.errors.full_messages
fc.flags_enabled = false
fc.save!
fc.save(validate: false)
ActionCable.server.broadcast 'smokedetector_messages',
{ message: "@#{fc.user&.username.tr(' ', '')} " +
"Your flag condition was disabled: #{failures.join(',')}" }
end
end
end
Expand Down

0 comments on commit 46d925d

Please sign in to comment.