FEATURE: Allow checking the raw response of a bounced email
This commit is contained in:
parent
1dda998a4e
commit
5296f00c28
|
@ -12,6 +12,10 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
|||
|
||||
load(id) {
|
||||
return IncomingEmail.find(id).then(result => this.set("model", result));
|
||||
},
|
||||
|
||||
loadFromBounced(id) {
|
||||
return IncomingEmail.findByBounced(id).then(result => this.set("model", result));
|
||||
}
|
||||
|
||||
});
|
||||
|
|
|
@ -19,6 +19,11 @@ IncomingEmail.reopenClass({
|
|||
return ajax(`/admin/email/incoming/${id}.json`);
|
||||
},
|
||||
|
||||
findByBounced(id) {
|
||||
return ajax(`/admin/email/incoming_from_bounced/${id}.json`);
|
||||
},
|
||||
|
||||
|
||||
findAll(filter, offset) {
|
||||
filter = filter || {};
|
||||
offset = offset || 0;
|
||||
|
|
|
@ -1,2 +1,14 @@
|
|||
import showModal from 'discourse/lib/show-modal';
|
||||
import AdminEmailLogs from 'admin/routes/admin-email-logs';
|
||||
export default AdminEmailLogs.extend({ status: "bounced" });
|
||||
|
||||
export default AdminEmailLogs.extend({
|
||||
status: "bounced",
|
||||
|
||||
actions: {
|
||||
showIncomingEmail(id) {
|
||||
showModal('admin-incoming-email', { admin: true });
|
||||
this.controllerFor("modals/admin-incoming-email").loadFromBounced(id);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
{{/if}}
|
||||
</td>
|
||||
<td><a href='mailto:{{unbound l.to_address}}'>{{l.to_address}}</a></td>
|
||||
<td>{{l.email_type}}</td>
|
||||
<td><a {{action "showIncomingEmail" l.id}}>{{l.email_type}}</a></td>
|
||||
</tr>
|
||||
{{else}}
|
||||
<tr><td colspan="4">{{i18n 'admin.email.logs.none'}}</td></tr>
|
||||
|
|
|
@ -88,6 +88,18 @@ class Admin::EmailController < Admin::AdminController
|
|||
render_json_dump(serializer)
|
||||
end
|
||||
|
||||
def incoming_from_bounced
|
||||
params.require(:id)
|
||||
|
||||
bounced = EmailLog.find(params[:id].to_i)
|
||||
email_local_part, email_domain = SiteSetting.notification_email.split('@')
|
||||
bounced_to_address = "#{email_local_part}+verp-#{bounced.bounce_key}@#{email_domain}"
|
||||
|
||||
incoming_email = IncomingEmail.find_by(to_addresses: bounced_to_address)
|
||||
serializer = IncomingEmailDetailsSerializer.new(incoming_email, root: false)
|
||||
render_json_dump(serializer)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def filter_email_logs(email_logs, params)
|
||||
|
|
|
@ -150,6 +150,7 @@ Discourse::Application.routes.draw do
|
|||
get "rejected"
|
||||
get "/incoming/:id/raw" => "email#raw_email"
|
||||
get "/incoming/:id" => "email#incoming"
|
||||
get "/incoming_from_bounced/:id" => "email#incoming_from_bounced"
|
||||
get "preview-digest" => "email#preview_digest"
|
||||
get "send-digest" => "email#send_digest"
|
||||
post "handle_mail"
|
||||
|
|
Loading…
Reference in New Issue