[MM-62427] Add message attachments validation (#30180)
* Add message attachments validation * Add props validation * Validate slack attachment fields * Update tests and library usage * Improve interactive dialog error for length checks * Allow predefined colors for slack attachments * Fix TestPostAction * Use const for data source * Add tests * Cleanup unused props * Add happy path tests * lint fixes * Add validation for PostActionOptions
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
5609489e86
Коммит
9b5d8d52bf
@@ -668,7 +668,7 @@ func doesNotifyPropsAllowPushNotification(user *model.User, channelNotifyProps m
|
||||
}
|
||||
|
||||
if (notify == model.ChannelNotifyAll) &&
|
||||
(post.UserId != user.Id || post.GetProp("from_webhook") == "true") {
|
||||
(post.UserId != user.Id || post.GetProp(model.PostPropsFromWebhook) == "true") {
|
||||
return ""
|
||||
}
|
||||
|
||||
@@ -833,16 +833,16 @@ func (a *App) buildFullPushNotificationMessage(c request.CTX, contentsConfig str
|
||||
}
|
||||
|
||||
msg.SenderName = senderName
|
||||
if ou, ok := post.GetProp("override_username").(string); ok && *cfg.ServiceSettings.EnablePostUsernameOverride {
|
||||
if ou, ok := post.GetProp(model.PostPropsOverrideUsername).(string); ok && *cfg.ServiceSettings.EnablePostUsernameOverride {
|
||||
msg.OverrideUsername = ou
|
||||
msg.SenderName = ou
|
||||
}
|
||||
|
||||
if oi, ok := post.GetProp("override_icon_url").(string); ok && *cfg.ServiceSettings.EnablePostIconOverride {
|
||||
if oi, ok := post.GetProp(model.PostPropsOverrideIconURL).(string); ok && *cfg.ServiceSettings.EnablePostIconOverride {
|
||||
msg.OverrideIconURL = oi
|
||||
}
|
||||
|
||||
if fw, ok := post.GetProp("from_webhook").(string); ok {
|
||||
if fw, ok := post.GetProp(model.PostPropsFromWebhook).(string); ok {
|
||||
msg.FromWebhook = fw
|
||||
}
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user