[server] Don't unset TRUNCATED if threadCursor is null
Summary:
While working on the previous diff, I noticed an issue here. Before D3351/D3352, we didn't actually use fetchMostRecentMessages anywhere in the codebase, which meant that we never set a threadCursor to null.
Now that we're actually using null threadCursors, we need to consider how they're handled here. In this particular case, we have some logic to unset TRUNCATED on the assumption that the result set is contiguous.
I don't think we can or should assume that for fetchMostRecentMessages. Instead, I think we should set TRUNCATED so that the MessageStore for that thread gets cleared, since we can't guarantee that whatever is currently in the MessageStore will be contiguous with the most recent messages.
Test Plan:
- I tested different values of defaultMaxMessageAge such that some threads would return fewer than defaultNumberPerThread, and some threads would return 0
- I tested threads that needed a fetchMostRecentMessages, and threads that needed multiple fetchMessagesBeforeCursor to get to the start
- I made sure all threads loaded all the way to the start of a thread if I kept scrolling
Reviewers: palys-swm, atul
Reviewed By: palys-swm
Subscribers: Adrian, karol-bisztyga, benschac
Differential Revision: https://phabricator.ashoat.com/D3411