ICU-753 Added unit tests for messages with only push notifications
Этот коммит содержится в:
@@ -656,7 +656,7 @@ func (a *App) getPushNotificationMessage(postMessage string, wasMentioned bool,
|
||||
}
|
||||
|
||||
// If the post only has images then push an appropriate message
|
||||
if len(message) == 0 && hasFiles {
|
||||
if len(postMessage) == 0 && hasFiles {
|
||||
if channelType == model.CHANNEL_DIRECT {
|
||||
message = senderName + userLocale("api.post.send_notifications_and_forget.push_image_only_dm")
|
||||
} else {
|
||||
|
||||
@@ -1345,6 +1345,30 @@ func TestGetPushNotificationMessage(t *testing.T) {
|
||||
ExpectedMessage: "user sent you a direct message",
|
||||
ExpectedCategory: model.CATEGORY_CAN_REPLY,
|
||||
},
|
||||
"only files, public channel": {
|
||||
HasFiles: true,
|
||||
ChannelType: model.CHANNEL_OPEN,
|
||||
ExpectedMessage: "user uploaded one or more files in channel",
|
||||
ExpectedCategory: model.CATEGORY_CAN_REPLY,
|
||||
},
|
||||
"only files, private channel": {
|
||||
HasFiles: true,
|
||||
ChannelType: model.CHANNEL_PRIVATE,
|
||||
ExpectedMessage: "user uploaded one or more files in channel",
|
||||
ExpectedCategory: model.CATEGORY_CAN_REPLY,
|
||||
},
|
||||
"only files, group message channel": {
|
||||
HasFiles: true,
|
||||
ChannelType: model.CHANNEL_GROUP,
|
||||
ExpectedMessage: "user uploaded one or more files in channel",
|
||||
ExpectedCategory: model.CATEGORY_CAN_REPLY,
|
||||
},
|
||||
"only files, direct message channel": {
|
||||
HasFiles: true,
|
||||
ChannelType: model.CHANNEL_DIRECT,
|
||||
ExpectedMessage: "user uploaded one or more files in a direct message",
|
||||
ExpectedCategory: model.CATEGORY_CAN_REPLY,
|
||||
},
|
||||
} {
|
||||
t.Run(name, func(t *testing.T) {
|
||||
locale := tc.Locale
|
||||
|
||||
@@ -1812,11 +1812,11 @@
|
||||
},
|
||||
{
|
||||
"id": "api.post.send_notifications_and_forget.push_image_only",
|
||||
"translation": " Uploaded one or more files in "
|
||||
"translation": " uploaded one or more files in "
|
||||
},
|
||||
{
|
||||
"id": "api.post.send_notifications_and_forget.push_image_only_dm",
|
||||
"translation": " Uploaded one or more files in a direct message"
|
||||
"translation": " uploaded one or more files in a direct message"
|
||||
},
|
||||
{
|
||||
"id": "api.post.send_notifications_and_forget.push_in",
|
||||
|
||||
Ссылка в новой задаче
Block a user