From e47aa004bbe20ee359de87ce506a5d8556716bb6 Mon Sep 17 00:00:00 2001 From: Greg Price Date: Thu, 29 Oct 2020 19:07:40 -0700 Subject: [PATCH] outbox [nfc]: Add a TODO to switch to numeric IDs when sending. These are only supported beginning with v2.0 of the server, so we can only do this either conditioned on the server version, or after older versions are no longer supported. This isn't something where the old way is deprecated and we're eager to remove it from a future server version -- to the contrary, we intend to support stream names and user emails here forever, as part of keeping easy things easy when writing bots. So there isn't a lot to be gained by eagerly switching; the main thing is it'd mitigate a race where a user we're sending to happens to have changed their email address right as we're trying to send. --- src/outbox/outboxActions.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/outbox/outboxActions.js b/src/outbox/outboxActions.js index e52678f6618..87dea0e752e 100644 --- a/src/outbox/outboxActions.js +++ b/src/outbox/outboxActions.js @@ -66,9 +66,12 @@ export const trySendMessages = (dispatch: Dispatch, getState: GetState): boolean // prettier-ignore const to = item.type === 'private' + // TODO(server-2.0): switch to numeric user IDs, not emails. ? item.display_recipient.map(r => r.email).join(',') + // TODO(server-2.0): switch to numeric stream IDs, not names. + // (This will require wiring the stream ID through to here.) // HACK: the server attempts to interpret this argument as JSON, then - // CSV, then a literal. To avoid misparsing, always use JSON. + // CSV, then a literal. To avoid misparsing, always use JSON. : JSON.stringify([item.display_recipient]); await api.sendMessage(auth, {