Increase performance when receiving messages (#5375)
Этот коммит содержится в:
коммит произвёл
Corey Hulen
родитель
fac85b676e
Коммит
ff741740ee
@@ -844,7 +844,15 @@ func SearchChannelsUserNotIn(teamId string, userId string, term string) (*model.
|
||||
}
|
||||
|
||||
func ViewChannel(view *model.ChannelView, teamId string, userId string, clearPushNotifications bool) *model.AppError {
|
||||
channelIds := []string{view.ChannelId}
|
||||
if err := SetActiveChannel(userId, view.ChannelId); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
channelIds := []string{}
|
||||
|
||||
if len(view.ChannelId) > 0 {
|
||||
channelIds = append(channelIds, view.ChannelId)
|
||||
}
|
||||
|
||||
var pchan store.StoreChannel
|
||||
if len(view.PrevChannelId) > 0 {
|
||||
@@ -855,6 +863,10 @@ func ViewChannel(view *model.ChannelView, teamId string, userId string, clearPus
|
||||
}
|
||||
}
|
||||
|
||||
if len(channelIds) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
uchan := Srv.Store.Channel().UpdateLastViewedAt(channelIds, userId)
|
||||
|
||||
if pchan != nil {
|
||||
@@ -871,10 +883,6 @@ func ViewChannel(view *model.ChannelView, teamId string, userId string, clearPus
|
||||
return result.Err
|
||||
}
|
||||
|
||||
message := model.NewWebSocketEvent(model.WEBSOCKET_EVENT_CHANNEL_VIEWED, teamId, "", userId, nil)
|
||||
message.Add("channel_id", view.ChannelId)
|
||||
go Publish(message)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user