ProjectLibertyLabs / gateway

Gateway microservices for DSNP/Frequency
https://projectlibertylabs.github.io/gateway/
Apache License 2.0
4 stars 1 forks source link

Display timestamp with posted content #381

Open JoeCap08055 opened 4 weeks ago

JoeCap08055 commented 4 weeks ago

Description

As a Gateway client developer, I want to know, as accurately as possible given the available data, the time at which a given piece of content was posted to the chain.

Elaboration

We have some TODOs in the code; one of them is to come up with a reasonable timestamp to attach to content display. For now, we've been encoding the time that the content (Parquet file) was retrieved from IPFS by the SAT backend; obviously this is not acceptable by any means, as it would be different for different backends. It's also not reasonable to expect a client to convert a block number to a time, because:

My initial thought is that content-watcher should get the timestamp inherent from the block when it retrieves content, and include that in the webhook payload when it sends out the content notifications. Reasons?

Discussion?

@aramikm pointed out below that the actual content does contain a published datetime. However, this raises a further issue: currently, content-watcher only broadcasts the on-chain content announcement, not the content itself. It's left to the client to retrieve the Parquet batch file and validate/decode it.

In discussion with @wilwade , it was suggested that perhaps it would be better (and more in line with the goal of the Gateway services) to have content-watcher fetch, decode and validate the batched Parquet content and broadcast the individual message content, instead of just an announcement of the content.

aramikm commented 4 weeks ago

We do have a published date field on content activity. https://spec.dsnp.org/ActivityContent/Types/Note.html