Add id field for sending messages.

The idea is to use this field to dismiss messages only when
a sync response with their id arrives.
This commit is contained in:
2019-03-15 18:01:07 -07:00
parent 7241d112b0
commit 1b0ad433b9
3 changed files with 8 additions and 3 deletions

View File

@@ -121,7 +121,7 @@ updateMarkdown m { roomId, text, markdown } =
sendMessageCmd = sendMarkdownMessage m.apiUrl (Maybe.withDefault "" m.token) (m.transactionId + 1) roomId text markdown
newModel =
{ m | transactionId = m.transactionId + 1
, sending = Dict.insert (m.transactionId + 1) (roomId, TextMessage text) m.sending
, sending = Dict.insert (m.transactionId + 1) (roomId, { body = TextMessage text, id = Nothing }) m.sending
}
in
(newModel, Cmd.batch [ storeValueCmd, sendMessageCmd, requestScrollCmd ])