MM-21898 - Part 1: Generate and use an interface instead of *A… (#13840)

* Generate and use an interface instead of *App
Этот коммит содержится в:
Eli Yukelzon
2020-02-13 13:26:58 +01:00
коммит произвёл GitHub
родитель 66fc096768
Коммит 17523fa5d9
200 изменённых файлов: 4553 добавлений и 2361 удалений

Просмотреть файл

@@ -47,7 +47,7 @@ type WebConn struct {
func (a *App) NewWebConn(ws *websocket.Conn, session model.Session, t goi18n.TranslateFunc, locale string) *WebConn {
if len(session.UserId) > 0 {
a.Srv.Go(func() {
a.Srv().Go(func() {
a.SetStatusOnline(session.UserId, false)
a.UpdateLastActivityAtIfNeeded(session)
})
@@ -132,7 +132,7 @@ func (wc *WebConn) readPump() {
wc.WebSocket.SetPongHandler(func(string) error {
wc.WebSocket.SetReadDeadline(time.Now().Add(PONG_WAIT))
if wc.IsAuthenticated() {
wc.App.Srv.Go(func() {
wc.App.Srv().Go(func() {
wc.App.SetStatusAwayIfNeeded(wc.UserId, false)
})
}
@@ -150,7 +150,7 @@ func (wc *WebConn) readPump() {
}
return
}
wc.App.Srv.WebSocketRouter.ServeWebSocket(wc, &req)
wc.App.Srv().WebSocketRouter.ServeWebSocket(wc, &req)
}
}
@@ -231,9 +231,9 @@ func (wc *WebConn) writePump() {
return
}
if wc.App.Metrics != nil {
wc.App.Srv.Go(func() {
wc.App.Metrics.IncrementWebSocketBroadcast(msg.EventType())
if wc.App.Metrics() != nil {
wc.App.Srv().Go(func() {
wc.App.Metrics().IncrementWebSocketBroadcast(msg.EventType())
})
}
}
@@ -374,7 +374,7 @@ func (wc *WebConn) ShouldSendEvent(msg *model.WebSocketEvent) bool {
}
if wc.AllChannelMembers == nil {
result, err := wc.App.Srv.Store.Channel().GetAllChannelMembersForUser(wc.UserId, true, false)
result, err := wc.App.Srv().Store.Channel().GetAllChannelMembersForUser(wc.UserId, true, false)
if err != nil {
mlog.Error("webhub.shouldSendEvent.", mlog.Err(err))
return false