MM-22706: pass along set_online flag in websocket response (#14591)

* MM-22706: pass along set_online flag in websocket response

To let the client know whether a user has created a post without
being online or not, we get the set_online query param and
pass it down to the websocket event being passed down to the client.

With this PR, the "data" field of the `posted` event will contain
a `set_online` boolean field set to true/false depending on the
query_param set_online value set in the createPost call.

* Setting to false for auto responder

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
Agniva De Sarker
2020-05-27 17:35:02 +05:30
коммит произвёл GitHub
родитель b9309b2af1
Коммит 14f7118dde
22 изменённых файлов: 211 добавлений и 176 удалений

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

@@ -29,7 +29,7 @@ func TestSendNotifications(t *testing.T) {
}, true)
require.Nil(t, appErr)
mentions, err := th.App.SendNotifications(post1, th.BasicTeam, th.BasicChannel, th.BasicUser, nil)
mentions, err := th.App.SendNotifications(post1, th.BasicTeam, th.BasicChannel, th.BasicUser, nil, true)
require.NoError(t, err)
require.NotNil(t, mentions)
require.True(t, utils.StringInSlice(th.BasicUser2.Id, mentions), "mentions", mentions)
@@ -44,7 +44,7 @@ func TestSendNotifications(t *testing.T) {
}, true)
require.Nil(t, appErr)
mentions, err = th.App.SendNotifications(post2, th.BasicTeam, dm, th.BasicUser, nil)
mentions, err = th.App.SendNotifications(post2, th.BasicTeam, dm, th.BasicUser, nil, true)
require.NoError(t, err)
require.NotNil(t, mentions)
@@ -60,12 +60,12 @@ func TestSendNotifications(t *testing.T) {
}, true)
require.Nil(t, appErr)
mentions, err = th.App.SendNotifications(post3, th.BasicTeam, dm, th.BasicUser, nil)
mentions, err = th.App.SendNotifications(post3, th.BasicTeam, dm, th.BasicUser, nil, true)
require.NoError(t, err)
require.NotNil(t, mentions)
th.BasicChannel.DeleteAt = 1
mentions, err = th.App.SendNotifications(post1, th.BasicTeam, th.BasicChannel, th.BasicUser, nil)
mentions, err = th.App.SendNotifications(post1, th.BasicTeam, th.BasicChannel, th.BasicUser, nil, true)
require.NoError(t, err)
require.Empty(t, mentions)
}