Class: RailsErrorDashboard::Commands::UnmuteError

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_error_dashboard/commands/unmute_error.rb

Overview

Command: Unmute notifications for an error Restores normal notification behavior for the error.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(error_id) ⇒ UnmuteError

Returns a new instance of UnmuteError.



12
13
14
# File 'lib/rails_error_dashboard/commands/unmute_error.rb', line 12

def initialize(error_id)
  @error_id = error_id
end

Class Method Details

.call(error_id) ⇒ Object



8
9
10
# File 'lib/rails_error_dashboard/commands/unmute_error.rb', line 8

def self.call(error_id)
  new(error_id).call
end

Instance Method Details

#callObject



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/rails_error_dashboard/commands/unmute_error.rb', line 16

def call
  error = ErrorLog.find(@error_id)
  error.update!(
    muted: false,
    muted_at: nil,
    muted_by: nil,
    muted_reason: nil
  )

  PluginRegistry.dispatch(:on_error_unmuted, error)
  error
end