RocketChat / Rocket.Chat

The communications platform that puts data protection first.
https://rocket.chat/
Other
40.62k stars 10.62k forks source link

Cannot filter livechat history messages with "ts" queryparameter #20854

Open t0bbz0n opened 3 years ago

t0bbz0n commented 3 years ago

Description:

Not possible to use "ts" query parameter to filter livechat history messages. Parameter is ignored.

Steps to reproduce:

  1. As a guest, open a new live chat.
  2. Send a couple of messages
  3. Using the REST API to load the Livechat history and specify the "ts"parameter to only retrieve the latest message

Example: https://myserver.rocket.chat/api/v1/livechat/messages.history/myroomid?token=guestToken&ls=2021-02-19T12:39:53.746Z

Expected behavior:

The history should only return messages AFTER the given timestamp.

Actual behavior:

All messages are returned.

Server Setup Information:

Client Setup Information

Additional context

If there is no magic that I don't see the parameter is actually called ls (found here but called ts in the documentation.

Either way, neither of the parameters does anything.

Not sure if the documentation is missing something or if I'm doing something wroing.

paurkedal commented 2 years ago

I hit the same issue using the realtime API. It looks like the ls parameter of the loadMessageHistory function only affects the unreadNotLoaded count of the result. I found the following workaround, or maybe it's the right way of doing it:

This gives only new messages, and not messages updated since the last session, but maybe that's sufficient here, given the mention of ts in the title? (In my case I also need messages which have been updated since the last session, in which case the only solution at the moment seems to be to load the full history on startup.)