Comments- How to sync the original creation date of the comment

Originally asked by Mena Goyen on 27 August 2019 (original question)


Hi there,

What is the best way to insert the original creation date of the comment in the synchronised comment? Right now it just shows the name of the comment author and comment text, for auditability reasons it would be beneficial to also have the original creation date. Is this possible?

Thanks,

Mena


Answer by Francis Martens (Exalate) on 27 August 2019

Hi Mena Goyen

You can easily modify the formatting of the receiving comment. For instance

(the code can be found here)

  • Line 1 - calls the mergeComments method
    the third argument is a closure which gets executed for each comment that is in the replica
  • Line 3,4,5,6 set the comment body
    to a combination of the displayName, the created date, and the body
  • Line 4 - comment.created?.format()
    Format the comment created date to day-month-year
  • Line 5 - insert a new line

Comments:

Mena Goyen commented on 14 September 2019

Thanks that worked, if we also wanted the time stamp how would we add that?

Francis Martens (Exalate) commented on 14 September 2019

Check the format specs here

I didn’t try it but something like ‘HH:mm:ss’ should do it.

Jorge Jerez Ibáñez commented on 01 August 2022

Hi

Is there any way to sync the created date of the commnets?