Fix push notification content for file only messages (#8346)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
342d05bcfc
Коммит
1b3808f3ec
@@ -623,7 +623,9 @@ func (a *App) getPushNotificationMessage(postMessage string, wasMentioned bool,
|
|||||||
message := ""
|
message := ""
|
||||||
category := ""
|
category := ""
|
||||||
|
|
||||||
if *a.Config().EmailSettings.PushNotificationContents == model.FULL_NOTIFICATION {
|
contentsConfig := *a.Config().EmailSettings.PushNotificationContents
|
||||||
|
|
||||||
|
if contentsConfig == model.FULL_NOTIFICATION {
|
||||||
category = model.CATEGORY_CAN_REPLY
|
category = model.CATEGORY_CAN_REPLY
|
||||||
|
|
||||||
if channelType == model.CHANNEL_DIRECT {
|
if channelType == model.CHANNEL_DIRECT {
|
||||||
@@ -631,7 +633,7 @@ func (a *App) getPushNotificationMessage(postMessage string, wasMentioned bool,
|
|||||||
} else {
|
} else {
|
||||||
message = senderName + userLocale("api.post.send_notifications_and_forget.push_in") + channelName + ": " + model.ClearMentionTags(postMessage)
|
message = senderName + userLocale("api.post.send_notifications_and_forget.push_in") + channelName + ": " + model.ClearMentionTags(postMessage)
|
||||||
}
|
}
|
||||||
} else if *a.Config().EmailSettings.PushNotificationContents == model.GENERIC_NO_CHANNEL_NOTIFICATION {
|
} else if contentsConfig == model.GENERIC_NO_CHANNEL_NOTIFICATION {
|
||||||
if channelType == model.CHANNEL_DIRECT {
|
if channelType == model.CHANNEL_DIRECT {
|
||||||
category = model.CATEGORY_CAN_REPLY
|
category = model.CATEGORY_CAN_REPLY
|
||||||
|
|
||||||
@@ -659,6 +661,8 @@ func (a *App) getPushNotificationMessage(postMessage string, wasMentioned bool,
|
|||||||
if len(postMessage) == 0 && hasFiles {
|
if len(postMessage) == 0 && hasFiles {
|
||||||
if channelType == model.CHANNEL_DIRECT {
|
if channelType == model.CHANNEL_DIRECT {
|
||||||
message = senderName + userLocale("api.post.send_notifications_and_forget.push_image_only_dm")
|
message = senderName + userLocale("api.post.send_notifications_and_forget.push_image_only_dm")
|
||||||
|
} else if contentsConfig == model.GENERIC_NO_CHANNEL_NOTIFICATION {
|
||||||
|
message = senderName + userLocale("api.post.send_notifications_and_forget.push_image_only_no_channel")
|
||||||
} else {
|
} else {
|
||||||
message = senderName + userLocale("api.post.send_notifications_and_forget.push_image_only") + channelName
|
message = senderName + userLocale("api.post.send_notifications_and_forget.push_image_only") + channelName
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1414,6 +1414,12 @@ func TestGetPushNotificationMessage(t *testing.T) {
|
|||||||
ExpectedMessage: "user uploaded one or more files in a direct message",
|
ExpectedMessage: "user uploaded one or more files in a direct message",
|
||||||
ExpectedCategory: model.CATEGORY_CAN_REPLY,
|
ExpectedCategory: model.CATEGORY_CAN_REPLY,
|
||||||
},
|
},
|
||||||
|
"only files without channel, public channel": {
|
||||||
|
HasFiles: true,
|
||||||
|
PushNotificationContents: model.GENERIC_NO_CHANNEL_NOTIFICATION,
|
||||||
|
ChannelType: model.CHANNEL_OPEN,
|
||||||
|
ExpectedMessage: "user uploaded one or more files",
|
||||||
|
},
|
||||||
} {
|
} {
|
||||||
t.Run(name, func(t *testing.T) {
|
t.Run(name, func(t *testing.T) {
|
||||||
locale := tc.Locale
|
locale := tc.Locale
|
||||||
|
|||||||
@@ -1814,6 +1814,10 @@
|
|||||||
"id": "api.post.send_notifications_and_forget.push_image_only",
|
"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_no_channel",
|
||||||
|
"translation": " uploaded one or more files"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "api.post.send_notifications_and_forget.push_image_only_dm",
|
"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"
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user