chore(apiv1): fix regression with attachment url in commentaire
This commit is contained in:
parent
ab522a3e40
commit
915aec6894
1 changed files with 10 additions and 1 deletions
|
@ -2,9 +2,18 @@ class CommentaireSerializer < ActiveModel::Serializer
|
|||
attributes :email,
|
||||
:body,
|
||||
:created_at,
|
||||
:piece_jointe_attachments
|
||||
:piece_jointe_attachments,
|
||||
:attachment
|
||||
|
||||
def created_at
|
||||
object.created_at&.in_time_zone('UTC')
|
||||
end
|
||||
|
||||
def attachment
|
||||
piece_jointe = object.piece_jointe_attachments.first
|
||||
|
||||
if piece_jointe&.virus_scanner&.safe?
|
||||
Rails.application.routes.url_helpers.url_for(piece_jointe)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue