Skip to content

Commit

Permalink
outbox [nfc]: Add a TODO to switch to numeric IDs when sending.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
gnprice committed Nov 6, 2020
1 parent 17b29ec commit e47aa00
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/outbox/outboxActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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, {
Expand Down

0 comments on commit e47aa00

Please sign in to comment.