Skip to content

Commit ef52dd9

Browse files
Merge pull request rails#42541 from santib/implement-actionmailbox-conductor-incinerate
Implement ActionMailbox incinerate in conductor
2 parents 2c51d7e + 75e6ea4 commit ef52dd9

File tree

5 files changed

+42
-20
lines changed

5 files changed

+42
-20
lines changed

actionmailbox/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
* Add ability to incinerate an inbound message through the conductor interface.
12

3+
*Santiago Bartesaghi*
24

35

46
Please check [6-1-stable](https://github.com/rails/rails/blob/6-1-stable/actionmailbox/CHANGELOG.md) for previous changes.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# frozen_string_literal: true
2+
3+
module Rails
4+
# Incinerating will destroy an email that is due and has already been processed.
5+
class Conductor::ActionMailbox::IncineratesController < Rails::Conductor::BaseController
6+
def create
7+
ActionMailbox::InboundEmail.find(params[:inbound_email_id]).incinerate
8+
9+
redirect_to main_app.rails_conductor_inbound_emails_url
10+
end
11+
end
12+
end

actionmailbox/app/views/rails/conductor/action_mailbox/inbound_emails/show.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<ul>
66
<li><%= button_to "Route again", main_app.rails_conductor_inbound_email_reroute_path(@inbound_email), method: :post %></li>
7-
<li>Incinerate</li>
7+
<li><%= button_to "Incinerate", main_app.rails_conductor_inbound_email_incinerate_path(@inbound_email), method: :post %></li>
88
</ul>
99

1010
<details>

actionmailbox/config/routes.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,6 @@
2121
post "inbound_emails/sources", to: "inbound_emails/sources#create", as: :rails_conductor_inbound_email_sources
2222

2323
post ":inbound_email_id/reroute" => "reroutes#create", as: :rails_conductor_inbound_email_reroute
24+
post ":inbound_email_id/incinerate" => "incinerates#create", as: :rails_conductor_inbound_email_incinerate
2425
end
2526
end

railties/test/commands/routes_test.rb

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -64,17 +64,18 @@ class Rails::Command::RoutesTest < ActiveSupport::TestCase
6464
MESSAGE
6565

6666
assert_equal <<~MESSAGE, run_routes_command([ "-g", "POST" ])
67-
Prefix Verb URI Pattern Controller#Action
68-
POST /cart(.:format) cart#create
69-
rails_postmark_inbound_emails POST /rails/action_mailbox/postmark/inbound_emails(.:format) action_mailbox/ingresses/postmark/inbound_emails#create
70-
rails_relay_inbound_emails POST /rails/action_mailbox/relay/inbound_emails(.:format) action_mailbox/ingresses/relay/inbound_emails#create
71-
rails_sendgrid_inbound_emails POST /rails/action_mailbox/sendgrid/inbound_emails(.:format) action_mailbox/ingresses/sendgrid/inbound_emails#create
72-
rails_mandrill_inbound_emails POST /rails/action_mailbox/mandrill/inbound_emails(.:format) action_mailbox/ingresses/mandrill/inbound_emails#create
73-
rails_mailgun_inbound_emails POST /rails/action_mailbox/mailgun/inbound_emails/mime(.:format) action_mailbox/ingresses/mailgun/inbound_emails#create
74-
POST /rails/conductor/action_mailbox/inbound_emails(.:format) rails/conductor/action_mailbox/inbound_emails#create
75-
rails_conductor_inbound_email_sources POST /rails/conductor/action_mailbox/inbound_emails/sources(.:format) rails/conductor/action_mailbox/inbound_emails/sources#create
76-
rails_conductor_inbound_email_reroute POST /rails/conductor/action_mailbox/:inbound_email_id/reroute(.:format) rails/conductor/action_mailbox/reroutes#create
77-
rails_direct_uploads POST /rails/active_storage/direct_uploads(.:format) active_storage/direct_uploads#create
67+
Prefix Verb URI Pattern Controller#Action
68+
POST /cart(.:format) cart#create
69+
rails_postmark_inbound_emails POST /rails/action_mailbox/postmark/inbound_emails(.:format) action_mailbox/ingresses/postmark/inbound_emails#create
70+
rails_relay_inbound_emails POST /rails/action_mailbox/relay/inbound_emails(.:format) action_mailbox/ingresses/relay/inbound_emails#create
71+
rails_sendgrid_inbound_emails POST /rails/action_mailbox/sendgrid/inbound_emails(.:format) action_mailbox/ingresses/sendgrid/inbound_emails#create
72+
rails_mandrill_inbound_emails POST /rails/action_mailbox/mandrill/inbound_emails(.:format) action_mailbox/ingresses/mandrill/inbound_emails#create
73+
rails_mailgun_inbound_emails POST /rails/action_mailbox/mailgun/inbound_emails/mime(.:format) action_mailbox/ingresses/mailgun/inbound_emails#create
74+
POST /rails/conductor/action_mailbox/inbound_emails(.:format) rails/conductor/action_mailbox/inbound_emails#create
75+
rails_conductor_inbound_email_sources POST /rails/conductor/action_mailbox/inbound_emails/sources(.:format) rails/conductor/action_mailbox/inbound_emails/sources#create
76+
rails_conductor_inbound_email_reroute POST /rails/conductor/action_mailbox/:inbound_email_id/reroute(.:format) rails/conductor/action_mailbox/reroutes#create
77+
rails_conductor_inbound_email_incinerate POST /rails/conductor/action_mailbox/:inbound_email_id/incinerate(.:format) rails/conductor/action_mailbox/incinerates#create
78+
rails_direct_uploads POST /rails/active_storage/direct_uploads(.:format) active_storage/direct_uploads#create
7879
MESSAGE
7980

8081
assert_equal <<~MESSAGE, run_routes_command([ "-g", "basketballs" ])
@@ -187,6 +188,7 @@ class Rails::Command::RoutesTest < ActiveSupport::TestCase
187188
new_rails_conductor_inbound_email_source GET /rails/conductor/action_mailbox/inbound_emails/sources/new(.:format) rails/conductor/action_mailbox/inbound_emails/sources#new
188189
rails_conductor_inbound_email_sources POST /rails/conductor/action_mailbox/inbound_emails/sources(.:format) rails/conductor/action_mailbox/inbound_emails/sources#create
189190
rails_conductor_inbound_email_reroute POST /rails/conductor/action_mailbox/:inbound_email_id/reroute(.:format) rails/conductor/action_mailbox/reroutes#create
191+
rails_conductor_inbound_email_incinerate POST /rails/conductor/action_mailbox/:inbound_email_id/incinerate(.:format) rails/conductor/action_mailbox/incinerates#create
190192
rails_service_blob GET /rails/active_storage/blobs/redirect/:signed_id/*filename(.:format) active_storage/blobs/redirect#show
191193
rails_service_blob_proxy GET /rails/active_storage/blobs/proxy/:signed_id/*filename(.:format) active_storage/blobs/proxy#show
192194
GET /rails/active_storage/blobs/:signed_id/*filename(.:format) active_storage/blobs/redirect#show
@@ -303,46 +305,51 @@ class Rails::Command::RoutesTest < ActiveSupport::TestCase
303305
URI | /rails/conductor/action_mailbox/:inbound_email_id/reroute(.:format)
304306
Controller#Action | rails/conductor/action_mailbox/reroutes#create
305307
--[ Route 19 ]-------------
308+
Prefix | rails_conductor_inbound_email_incinerate
309+
Verb | POST
310+
URI | /rails/conductor/action_mailbox/:inbound_email_id/incinerate(.:format)
311+
Controller#Action | rails/conductor/action_mailbox/incinerates#create
312+
--[ Route 20 ]-------------
306313
Prefix | rails_service_blob
307314
Verb | GET
308315
URI | /rails/active_storage/blobs/redirect/:signed_id/*filename(.:format)
309316
Controller#Action | active_storage/blobs/redirect#show
310-
--[ Route 20 ]-------------
317+
--[ Route 21 ]-------------
311318
Prefix | rails_service_blob_proxy
312319
Verb | GET
313320
URI | /rails/active_storage/blobs/proxy/:signed_id/*filename(.:format)
314321
Controller#Action | active_storage/blobs/proxy#show
315-
--[ Route 21 ]-------------
322+
--[ Route 22 ]-------------
316323
Prefix |
317324
Verb | GET
318325
URI | /rails/active_storage/blobs/:signed_id/*filename(.:format)
319326
Controller#Action | active_storage/blobs/redirect#show
320-
--[ Route 22 ]-------------
327+
--[ Route 23 ]-------------
321328
Prefix | rails_blob_representation
322329
Verb | GET
323330
URI | /rails/active_storage/representations/redirect/:signed_blob_id/:variation_key/*filename(.:format)
324331
Controller#Action | active_storage/representations/redirect#show
325-
--[ Route 23 ]-------------
332+
--[ Route 24 ]-------------
326333
Prefix | rails_blob_representation_proxy
327334
Verb | GET
328335
URI | /rails/active_storage/representations/proxy/:signed_blob_id/:variation_key/*filename(.:format)
329336
Controller#Action | active_storage/representations/proxy#show
330-
--[ Route 24 ]-------------
337+
--[ Route 25 ]-------------
331338
Prefix |
332339
Verb | GET
333340
URI | /rails/active_storage/representations/:signed_blob_id/:variation_key/*filename(.:format)
334341
Controller#Action | active_storage/representations/redirect#show
335-
--[ Route 25 ]-------------
342+
--[ Route 26 ]-------------
336343
Prefix | rails_disk_service
337344
Verb | GET
338345
URI | /rails/active_storage/disk/:encoded_key/*filename(.:format)
339346
Controller#Action | active_storage/disk#show
340-
--[ Route 26 ]-------------
347+
--[ Route 27 ]-------------
341348
Prefix | update_rails_disk_service
342349
Verb | PUT
343350
URI | /rails/active_storage/disk/:encoded_token(.:format)
344351
Controller#Action | active_storage/disk#update
345-
--[ Route 27 ]-------------
352+
--[ Route 28 ]-------------
346353
Prefix | rails_direct_uploads
347354
Verb | POST
348355
URI | /rails/active_storage/direct_uploads(.:format)

0 commit comments

Comments
 (0)