diff options
author | enahum <nahumhbl@gmail.com> | 2016-09-27 11:19:50 -0300 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2016-09-27 10:19:50 -0400 |
commit | 60347559c7fb857bd5afcd93e65b6e220625da79 (patch) | |
tree | dd60ee950e12a9c64f82a1d5239d9d3327aa7ae0 /model/websocket_message.go | |
parent | bfca752940a13c874788b0c885d36b2b263bd4fb (diff) | |
download | chat-60347559c7fb857bd5afcd93e65b6e220625da79.tar.gz chat-60347559c7fb857bd5afcd93e65b6e220625da79.tar.bz2 chat-60347559c7fb857bd5afcd93e65b6e220625da79.zip |
PLT-3734 Cleaning up shouldSendEvent function (#4024)
* PLT-3734 Cleaning up shouldSendEvent function
* Fix LHS unread highlight and jewel mentions
Diffstat (limited to 'model/websocket_message.go')
-rw-r--r-- | model/websocket_message.go | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/model/websocket_message.go b/model/websocket_message.go index 4e1f1dee3..9bce1e825 100644 --- a/model/websocket_message.go +++ b/model/websocket_message.go @@ -33,20 +33,26 @@ type WebSocketMessage interface { IsValid() bool } +type WebsocketBroadcast struct { + OmitUsers map[string]bool `json:"-"` // broadcast is omitted for users listed here + UserId string `json:"user_id"` // broadcast only occurs for this user + ChannelId string `json:"channel_id"` // broadcast only occurs for users in this channel + TeamId string `json:"team_id"` // broadcast only occurs for users in this team +} + type WebSocketEvent struct { - TeamId string `json:"team_id"` - ChannelId string `json:"channel_id"` - UserId string `json:"user_id"` Event string `json:"event"` Data map[string]interface{} `json:"data"` + Broadcast *WebsocketBroadcast `json:"broadcast"` } func (m *WebSocketEvent) Add(key string, value interface{}) { m.Data[key] = value } -func NewWebSocketEvent(teamId string, channelId string, userId string, event string) *WebSocketEvent { - return &WebSocketEvent{TeamId: teamId, ChannelId: channelId, UserId: userId, Event: event, Data: make(map[string]interface{})} +func NewWebSocketEvent(event, teamId, channelId, userId string, omitUsers map[string]bool) *WebSocketEvent { + return &WebSocketEvent{Event: event, Data: make(map[string]interface{}), + Broadcast: &WebsocketBroadcast{TeamId: teamId, ChannelId: channelId, UserId: userId, OmitUsers: omitUsers}} } func (o *WebSocketEvent) IsValid() bool { |