aboutsummaryrefslogtreecommitdiffstats
path: root/actionmailbox/app/controllers/rails/conductor/action_mailbox
diff options
context:
space:
mode:
Diffstat (limited to 'actionmailbox/app/controllers/rails/conductor/action_mailbox')
-rw-r--r--actionmailbox/app/controllers/rails/conductor/action_mailbox/inbound_emails_controller.rb44
-rw-r--r--actionmailbox/app/controllers/rails/conductor/action_mailbox/reroutes_controller.rb26
2 files changed, 37 insertions, 33 deletions
diff --git a/actionmailbox/app/controllers/rails/conductor/action_mailbox/inbound_emails_controller.rb b/actionmailbox/app/controllers/rails/conductor/action_mailbox/inbound_emails_controller.rb
index 7f7b0e004e..30d6afe0c0 100644
--- a/actionmailbox/app/controllers/rails/conductor/action_mailbox/inbound_emails_controller.rb
+++ b/actionmailbox/app/controllers/rails/conductor/action_mailbox/inbound_emails_controller.rb
@@ -1,29 +1,31 @@
# frozen_string_literal: true
-class Rails::Conductor::ActionMailbox::InboundEmailsController < Rails::Conductor::BaseController
- def index
- @inbound_emails = ActionMailbox::InboundEmail.order(created_at: :desc)
- end
-
- def new
- end
-
- def show
- @inbound_email = ActionMailbox::InboundEmail.find(params[:id])
- end
+module Rails
+ class Conductor::ActionMailbox::InboundEmailsController < Rails::Conductor::BaseController
+ def index
+ @inbound_emails = ActionMailbox::InboundEmail.order(created_at: :desc)
+ end
- def create
- inbound_email = create_inbound_email(new_mail)
- redirect_to main_app.rails_conductor_inbound_email_url(inbound_email)
- end
+ def new
+ end
- private
- def new_mail
- Mail.new params.require(:mail).permit(:from, :to, :cc, :bcc, :in_reply_to, :subject, :body).to_h
+ def show
+ @inbound_email = ActionMailbox::InboundEmail.find(params[:id])
end
- def create_inbound_email(mail)
- ActionMailbox::InboundEmail.create! raw_email: \
- { io: StringIO.new(mail.to_s), filename: "inbound.eml", content_type: "message/rfc822" }
+ def create
+ inbound_email = create_inbound_email(new_mail)
+ redirect_to main_app.rails_conductor_inbound_email_url(inbound_email)
end
+
+ private
+ def new_mail
+ Mail.new params.require(:mail).permit(:from, :to, :cc, :bcc, :in_reply_to, :subject, :body).to_h
+ end
+
+ def create_inbound_email(mail)
+ ActionMailbox::InboundEmail.create! raw_email: \
+ { io: StringIO.new(mail.to_s), filename: "inbound.eml", content_type: "message/rfc822" }
+ end
+ end
end
diff --git a/actionmailbox/app/controllers/rails/conductor/action_mailbox/reroutes_controller.rb b/actionmailbox/app/controllers/rails/conductor/action_mailbox/reroutes_controller.rb
index c53203049b..05b1ca9a39 100644
--- a/actionmailbox/app/controllers/rails/conductor/action_mailbox/reroutes_controller.rb
+++ b/actionmailbox/app/controllers/rails/conductor/action_mailbox/reroutes_controller.rb
@@ -1,17 +1,19 @@
# frozen_string_literal: true
-# Rerouting will run routing and processing on an email that has already been, or attempted to be, processed.
-class Rails::Conductor::ActionMailbox::ReroutesController < Rails::Conductor::BaseController
- def create
- inbound_email = ActionMailbox::InboundEmail.find(params[:inbound_email_id])
- reroute inbound_email
+module Rails
+ # Rerouting will run routing and processing on an email that has already been, or attempted to be, processed.
+ class Conductor::ActionMailbox::ReroutesController < Rails::Conductor::BaseController
+ def create
+ inbound_email = ActionMailbox::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
+ 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
end