mirror of
https://github.com/discourse/discourse.git
synced 2024-12-15 18:23:39 +08:00
30990006a9
This reduces chances of errors where consumers of strings mutate inputs and reduces memory usage of the app. Test suite passes now, but there may be some stuff left, so we will run a few sites on a branch prior to merging
25 lines
551 B
Ruby
25 lines
551 B
Ruby
# frozen_string_literal: true
|
|
|
|
class EmailLogSerializer < ApplicationSerializer
|
|
include EmailLogsMixin
|
|
|
|
attributes :reply_key,
|
|
:bounced,
|
|
:has_bounce_key
|
|
|
|
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
|
|
end
|