Properly unset active channel in the server (#26846)
* Properly unset active channel in the server * Address feedback --------- Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
69fe5c06e4
Коммит
c22509eca2
@@ -441,12 +441,14 @@ func TestDoesStatusAllowPushNotification(t *testing.T) {
|
||||
away := &model.Status{UserId: userID, Status: model.StatusAway, Manual: false, LastActivityAt: 0, ActiveChannel: ""}
|
||||
online := &model.Status{UserId: userID, Status: model.StatusOnline, Manual: false, LastActivityAt: model.GetMillis(), ActiveChannel: ""}
|
||||
dnd := &model.Status{UserId: userID, Status: model.StatusDnd, Manual: true, LastActivityAt: model.GetMillis(), ActiveChannel: ""}
|
||||
activeOnChannel := &model.Status{UserId: userID, Status: model.StatusOnline, Manual: false, LastActivityAt: model.GetMillis(), ActiveChannel: channelID}
|
||||
|
||||
tt := []struct {
|
||||
name string
|
||||
userNotifySetting string
|
||||
status *model.Status
|
||||
channelID string
|
||||
isCRT bool
|
||||
expected model.NotificationReason
|
||||
}{
|
||||
{
|
||||
@@ -491,6 +493,21 @@ func TestDoesStatusAllowPushNotification(t *testing.T) {
|
||||
channelID: "",
|
||||
expected: model.NotificationReasonUserIsActive,
|
||||
},
|
||||
{
|
||||
name: "WHEN props is ONLINE and user is online and active within the channel",
|
||||
userNotifySetting: model.StatusOnline,
|
||||
status: activeOnChannel,
|
||||
channelID: channelID,
|
||||
expected: model.NotificationReasonUserIsActive,
|
||||
},
|
||||
{
|
||||
name: "WHEN props is ONLINE and user is online and active within a thread in the channel",
|
||||
userNotifySetting: model.StatusOnline,
|
||||
status: activeOnChannel,
|
||||
channelID: channelID,
|
||||
expected: "",
|
||||
isCRT: true,
|
||||
},
|
||||
{
|
||||
name: "WHEN props is ONLINE and user is dnd with channel",
|
||||
userNotifySetting: model.StatusOnline,
|
||||
@@ -623,7 +640,7 @@ func TestDoesStatusAllowPushNotification(t *testing.T) {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
userNotifyProps := make(map[string]string)
|
||||
userNotifyProps["push_status"] = tc.userNotifySetting
|
||||
assert.Equal(t, tc.expected, DoesStatusAllowPushNotification(userNotifyProps, tc.status, tc.channelID))
|
||||
assert.Equal(t, tc.expected, DoesStatusAllowPushNotification(userNotifyProps, tc.status, tc.channelID, tc.isCRT))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user