2019-05-02 18:17:27 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2013-02-05 14:16:51 -05:00
|
|
|
class EmailLogSerializer < ApplicationSerializer
|
2018-07-24 00:55:43 -04:00
|
|
|
include EmailLogsMixin
|
2013-02-07 10:45:24 -05:00
|
|
|
|
2024-01-02 20:27:25 -05:00
|
|
|
attributes :cc_addresses,
|
|
|
|
:post_id,
|
|
|
|
:reply_key,
|
|
|
|
:bounced,
|
|
|
|
:has_bounce_key,
|
|
|
|
:smtp_transaction_response
|
2013-06-10 16:46:08 -04:00
|
|
|
|
2013-02-05 14:16:51 -05:00
|
|
|
has_one :user, serializer: BasicUserSerializer, embed: :objects
|
2018-07-18 04:28:44 -04:00
|
|
|
|
2024-01-02 20:27:25 -05:00
|
|
|
def cc_addresses
|
|
|
|
return if object.cc_addresses.blank?
|
|
|
|
object.cc_addresses_split
|
|
|
|
end
|
2018-07-18 04:28:44 -04:00
|
|
|
def include_reply_key?
|
|
|
|
reply_keys = @options[:reply_keys]
|
|
|
|
reply_keys.present? && reply_keys[[object.post_id, object.user_id]]
|
|
|
|
end
|
|
|
|
|
|
|
|
def reply_key
|
2019-01-09 20:56:03 -05:00
|
|
|
@options[:reply_keys][[object.post_id, object.user_id]].delete("-")
|
2018-07-18 04:28:44 -04:00
|
|
|
end
|
2019-03-26 12:55:40 -04:00
|
|
|
|
|
|
|
def has_bounce_key
|
|
|
|
object.bounce_key.present?
|
|
|
|
end
|
2013-02-05 14:16:51 -05:00
|
|
|
end
|