discourse/app/serializers/email_log_serializer.rb

25 lines
551 B
Ruby
Raw Normal View History

# frozen_string_literal: true
2013-02-05 13:16:51 -06:00
class EmailLogSerializer < ApplicationSerializer
include EmailLogsMixin
2013-02-07 09:45:24 -06:00
attributes :reply_key,
:bounced,
:has_bounce_key
2013-02-05 13:16:51 -06:00
has_one :user, serializer: BasicUserSerializer, embed: :objects
def include_reply_key?
reply_keys = @options[:reply_keys]
reply_keys.present? && reply_keys[[object.post_id, object.user_id]]
end
def reply_key
@options[:reply_keys][[object.post_id, object.user_id]].delete("-")
end
def has_bounce_key
object.bounce_key.present?
end
2013-02-05 13:16:51 -06:00
end