Bulk message deletes are counted more than once on the message_count property for threads over the HTTP API – PullAnswer

Description

the message_count property on threads has the total count of bulk-message-deletes twice subtracted from the current message count, offsetting the message_count accuracy by however many messages were deleted. This problem only shows itself with the rest API, and is not present when using the gateway, meaning that locally tracking the state is accurate to the gateway, but wildly off when fetching the thread with the rest API.

Steps to Reproduce

  • Create a new thread
  • Send some messages, at least 6 or more.
  • Bulk delete 2 or more messages, but not more than half of the messages, (eg if you sent 9, delete a max of 4, but recommended to delete 2 or 3)
  • fetch the thread with the http api, and inspect the thread’s message_count property

Optional:

  • connect to the gateway and see the thread’s message_count property is accurate and did not doubly subtract the results.

Expected Behavior

The http api matches the gateway for how many messages currently exist in the thread.

Current Behavior

The HTTP API has subtracted the deleted messages twice from its counter, so if 4 messages were deleted in bulk, the counter is 4 less than what it should be.

Screenshots/Videos

No response

Client and System Information

any

Read more here: Source link