2019-05-03 06:17:27 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2013-02-06 03:16:51 +08:00
|
|
|
class EmailLogSerializer < ApplicationSerializer
|
2018-07-24 12:55:43 +08:00
|
|
|
include EmailLogsMixin
|
2013-02-07 23:45:24 +08:00
|
|
|
|
2022-08-03 06:11:54 +08:00
|
|
|
attributes :reply_key, :bounced, :has_bounce_key, :smtp_transaction_response
|
2013-06-11 04:46:08 +08:00
|
|
|
|
2013-02-06 03:16:51 +08:00
|
|
|
has_one :user, serializer: BasicUserSerializer, embed: :objects
|
2018-07-18 16:28:44 +08: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-10 09:56:03 +08:00
|
|
|
@options[:reply_keys][[object.post_id, object.user_id]].delete("-")
|
2018-07-18 16:28:44 +08:00
|
|
|
end
|
2019-03-27 00:55:40 +08:00
|
|
|
|
|
|
|
def has_bounce_key
|
|
|
|
object.bounce_key.present?
|
|
|
|
end
|
2013-02-06 03:16:51 +08:00
|
|
|
end
|