From afb320c12b375a438a0b54c5b3ed77aaca83ee87 Mon Sep 17 00:00:00 2001 From: Chris Bobbe Date: Thu, 6 Feb 2020 11:15:28 -0800 Subject: [PATCH 1/2] fetch messages: Set LAST_MESSAGE_ANCHOR to 10000000000000000 (10^16). Fixes: #3654. The server correctly interprets this special number as indicating that we want the latest messages. The larger value we had been using will certainly get the latest messages, because it's larger than any possible message ID, but the server won't make that inference and can incorrectly report `found_newest: false`. Later, we can conditionalize on the server version to use the updated API merged in https://github.com/zulip/zulip/pull/13747, which uses the string 'newest' instead of a special number. [greg: revised commit message] --- src/constants.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/constants.js b/src/constants.js index d5789e2c9d5..d234e16b2ff 100644 --- a/src/constants.js +++ b/src/constants.js @@ -16,4 +16,4 @@ export const FIRST_UNREAD_ANCHOR = 0; * want to retrieve the newest messages for a narrow, without actually * knowing their IDs. */ -export const LAST_MESSAGE_ANCHOR = Number.MAX_SAFE_INTEGER; +export const LAST_MESSAGE_ANCHOR = 10000000000000000; // sixteen zeroes From b81847971e1d4cc3e799ebe3916e7a6d28b4927f Mon Sep 17 00:00:00 2001 From: Greg Price Date: Thu, 6 Feb 2020 18:50:37 -0800 Subject: [PATCH 2/2] fetch messages [nfc]: Add a brief comment explaining that 10^16 value. --- src/constants.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/constants.js b/src/constants.js index d234e16b2ff..3a4c2ece48f 100644 --- a/src/constants.js +++ b/src/constants.js @@ -16,4 +16,6 @@ export const FIRST_UNREAD_ANCHOR = 0; * want to retrieve the newest messages for a narrow, without actually * knowing their IDs. */ +// This special value is understood by the server, corresponding to +// LARGER_THAN_MAX_MESSAGE_ID there. See #3654. export const LAST_MESSAGE_ANCHOR = 10000000000000000; // sixteen zeroes