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:
parent
7241d112b0
commit
1b0ad433b9
|
@ -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 ])
|
||||
|
|
|
@ -2,7 +2,12 @@ module Scylla.Messages exposing (..)
|
|||
import Scylla.Sync exposing (RoomEvent)
|
||||
import Scylla.Login exposing (Username)
|
||||
|
||||
type SendingMessage = TextMessage String
|
||||
type SendingMessageBody = TextMessage String
|
||||
|
||||
type alias SendingMessage =
|
||||
{ body : SendingMessageBody
|
||||
, id : Maybe String
|
||||
}
|
||||
|
||||
type Message =
|
||||
Sending SendingMessage
|
||||
|
|
|
@ -213,7 +213,7 @@ messageView m msg = case msg of
|
|||
Received re -> roomEventView m re
|
||||
|
||||
sendingMessageView : Model -> SendingMessage -> Html Msg
|
||||
sendingMessageView m msg = case msg of
|
||||
sendingMessageView m msg = case msg.body of
|
||||
TextMessage t -> text t
|
||||
|
||||
roomEventView : Model -> RoomEvent -> Maybe (Html Msg)
|
||||
|
|
Loading…
Reference in New Issue
Block a user