mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Add rerouting option
This commit is contained in:
parent
c9d8f6650d
commit
5ad0813322
4 changed files with 21 additions and 5 deletions
|
@ -0,0 +1,14 @@
|
||||||
|
class Rails::Conductor::ActionMailroom::ReroutesController < Rails::Conductor::BaseController
|
||||||
|
def create
|
||||||
|
inbound_email = ActionMailroom::InboundEmail.find(params[:inbound_email_id])
|
||||||
|
reroute inbound_email
|
||||||
|
|
||||||
|
redirect_to main_app.rails_conductor_inbound_email_url(inbound_email)
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
def reroute(inbound_email)
|
||||||
|
inbound_email.pending!
|
||||||
|
inbound_email.route_later
|
||||||
|
end
|
||||||
|
end
|
|
@ -5,8 +5,7 @@ module ActionMailroom::InboundEmail::Routable
|
||||||
after_create_commit :route_later, if: ->(inbound_email) { inbound_email.pending? }
|
after_create_commit :route_later, if: ->(inbound_email) { inbound_email.pending? }
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
def route_later
|
||||||
def route_later
|
ActionMailroom::RoutingJob.perform_later self
|
||||||
ActionMailroom::RoutingJob.perform_later self
|
end
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<h1><%= @inbound_email.message_id %>: <%= @inbound_email.status %></h1>
|
<h1><%= @inbound_email.message_id %>: <%= @inbound_email.status %></h1>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<li>Retry</li>
|
<li><%= button_to "Route again", main_app.rails_conductor_inbound_email_reroute_path(@inbound_email), method: :post %></li>
|
||||||
<li>Incinerate</li>
|
<li>Incinerate</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
@ -11,3 +11,5 @@
|
||||||
<summary>Full email source</summary>
|
<summary>Full email source</summary>
|
||||||
<pre><%= @inbound_email.source %></pre>
|
<pre><%= @inbound_email.source %></pre>
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
|
<%= link_to "Back to all inbound emails", main_app.rails_conductor_inbound_emails_path %>
|
|
@ -6,5 +6,6 @@ Rails.application.routes.draw do
|
||||||
# TODO: Should these be mounted within the engine only?
|
# TODO: Should these be mounted within the engine only?
|
||||||
scope "rails/conductor/action_mailroom/", module: "rails/conductor/action_mailroom" do
|
scope "rails/conductor/action_mailroom/", module: "rails/conductor/action_mailroom" do
|
||||||
resources :inbound_emails, as: :rails_conductor_inbound_emails
|
resources :inbound_emails, as: :rails_conductor_inbound_emails
|
||||||
|
post ":inbound_email_id/reroute" => "reroutes#create", as: :rails_conductor_inbound_email_reroute
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue