UX: Hide link to incoming email when there is no bounce key

For example, webhooks mark email log entries as bounced without there ever being an incoming email.
This commit is contained in:
Gerhard Schlager 2019-03-26 17:55:40 +01:00
parent 02f2ce8b05
commit de011b53b5
2 changed files with 11 additions and 2 deletions

View File

@ -28,7 +28,11 @@
{{/if}}
</td>
<td><a href='mailto:{{unbound l.to_address}}'>{{l.to_address}}</a></td>
<td><a {{action "showIncomingEmail" l.id}}>{{l.email_type}}</a></td>
{{#if l.has_bounce_key}}
<td><a {{action "showIncomingEmail" l.id}}>{{l.email_type}}</a></td>
{{else}}
<td>{{l.email_type}}</td>
{{/if}}
</tr>
{{else}}
{{#unless loading}}

View File

@ -2,7 +2,8 @@ class EmailLogSerializer < ApplicationSerializer
include EmailLogsMixin
attributes :reply_key,
:bounced
:bounced,
:has_bounce_key
has_one :user, serializer: BasicUserSerializer, embed: :objects
@ -14,4 +15,8 @@ class EmailLogSerializer < ApplicationSerializer
def reply_key
@options[:reply_keys][[object.post_id, object.user_id]].delete("-")
end
def has_bounce_key
object.bounce_key.present?
end
end