mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 18:05:37 +08:00
b4a89ea610
* add cc addresses and post_id to sent email logs * sort cc addresses by email address filter value and collapse additional addreses into tooltip * add slice helper for use in ember tempaltes
32 lines
739 B
Ruby
32 lines
739 B
Ruby
# frozen_string_literal: true
|
|
|
|
class EmailLogSerializer < ApplicationSerializer
|
|
include EmailLogsMixin
|
|
|
|
attributes :cc_addresses,
|
|
:post_id,
|
|
:reply_key,
|
|
:bounced,
|
|
:has_bounce_key,
|
|
:smtp_transaction_response
|
|
|
|
has_one :user, serializer: BasicUserSerializer, embed: :objects
|
|
|
|
def cc_addresses
|
|
return if object.cc_addresses.blank?
|
|
object.cc_addresses_split
|
|
end
|
|
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
|
|
end
|