PLT-3734 Cleaning up shouldSendEvent function (#4024)
* PLT-3734 Cleaning up shouldSendEvent function * Fix LHS unread highlight and jewel mentions
Этот коммит содержится в:
коммит произвёл
Christopher Speller
родитель
bfca752940
Коммит
60347559c7
19
api/user.go
19
api/user.go
@@ -269,8 +269,8 @@ func CreateUser(user *model.User) (*model.User, *model.AppError) {
|
||||
|
||||
ruser.Sanitize(map[string]bool{})
|
||||
|
||||
// This message goes to every channel, so the channelId is irrelevant
|
||||
go Publish(model.NewWebSocketEvent("", "", ruser.Id, model.WEBSOCKET_EVENT_NEW_USER))
|
||||
// This message goes to everyone, so the teamId, channelId and userId are irrelevant
|
||||
go Publish(model.NewWebSocketEvent(model.WEBSOCKET_EVENT_NEW_USER, "", "", "", nil))
|
||||
|
||||
return ruser, nil
|
||||
}
|
||||
@@ -1289,8 +1289,11 @@ func uploadProfileImage(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
} else {
|
||||
user := result.Data.(*model.User)
|
||||
user = sanitizeProfile(c, user)
|
||||
message := model.NewWebSocketEvent("", "", c.Session.UserId, model.WEBSOCKET_EVENT_USER_UPDATED)
|
||||
omitUsers := make(map[string]bool, 1)
|
||||
omitUsers[user.Id] = true
|
||||
message := model.NewWebSocketEvent(model.WEBSOCKET_EVENT_USER_UPDATED, "", "", "", omitUsers)
|
||||
message.Add("user", user)
|
||||
|
||||
go Publish(message)
|
||||
}
|
||||
|
||||
@@ -1340,7 +1343,9 @@ func updateUser(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
updatedUser := rusers[0]
|
||||
updatedUser = sanitizeProfile(c, updatedUser)
|
||||
|
||||
message := model.NewWebSocketEvent("", "", user.Id, model.WEBSOCKET_EVENT_USER_UPDATED)
|
||||
omitUsers := make(map[string]bool, 1)
|
||||
omitUsers[user.Id] = true
|
||||
message := model.NewWebSocketEvent(model.WEBSOCKET_EVENT_USER_UPDATED, "", "", "", omitUsers)
|
||||
message.Add("user", updatedUser)
|
||||
go Publish(message)
|
||||
|
||||
@@ -2496,8 +2501,12 @@ func userTyping(req *model.WebSocketRequest) (map[string]interface{}, *model.App
|
||||
parentId = ""
|
||||
}
|
||||
|
||||
event := model.NewWebSocketEvent("", channelId, req.Session.UserId, model.WEBSOCKET_EVENT_TYPING)
|
||||
omitUsers := make(map[string]bool, 1)
|
||||
omitUsers[req.Session.UserId] = true
|
||||
|
||||
event := model.NewWebSocketEvent(model.WEBSOCKET_EVENT_TYPING, "", channelId, "", omitUsers)
|
||||
event.Add("parent_id", parentId)
|
||||
event.Add("user_id", req.Session.UserId)
|
||||
go Publish(event)
|
||||
|
||||
return nil, nil
|
||||
|
||||
Ссылка в новой задаче
Block a user