[MM-19526] /code is rendering HTML incorrectly (#12840)
* text from /code command needs to be treated differently when processed * PR comments
Этот коммит содержится в:
коммит произвёл
Joram Wilander
родитель
94db07f65f
Коммит
c12c585fb8
@@ -39,8 +39,13 @@ func GetCommandProvider(name string) CommandProvider {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a *App) CreateCommandPost(post *model.Post, teamId string, response *model.CommandResponse) (*model.Post, *model.AppError) {
|
||||
post.Message = model.ParseSlackLinksToMarkdown(response.Text)
|
||||
func (a *App) CreateCommandPost(post *model.Post, teamId string, response *model.CommandResponse, skipSlackParsing bool) (*model.Post, *model.AppError) {
|
||||
if skipSlackParsing {
|
||||
post.Message = response.Text
|
||||
} else {
|
||||
post.Message = model.ParseSlackLinksToMarkdown(response.Text)
|
||||
}
|
||||
|
||||
post.CreateAt = model.GetMillis()
|
||||
|
||||
if strings.HasPrefix(post.Type, model.POST_SYSTEM_MESSAGE_PREFIX) {
|
||||
@@ -430,11 +435,16 @@ func (a *App) HandleCommandResponsePost(command *model.Command, args *model.Comm
|
||||
post.AddProp("from_webhook", "true")
|
||||
}
|
||||
|
||||
// Process Slack text replacements
|
||||
response.Text = a.ProcessSlackText(response.Text)
|
||||
response.Attachments = a.ProcessSlackAttachments(response.Attachments)
|
||||
// Do not process text if this is a code block
|
||||
skipSlackParsing := command.Trigger == "code"
|
||||
|
||||
if _, err := a.CreateCommandPost(post, args.TeamId, response); err != nil {
|
||||
// Process Slack text replacements
|
||||
if !skipSlackParsing {
|
||||
response.Text = a.ProcessSlackText(response.Text)
|
||||
response.Attachments = a.ProcessSlackAttachments(response.Attachments)
|
||||
}
|
||||
|
||||
if _, err := a.CreateCommandPost(post, args.TeamId, response, skipSlackParsing); err != nil {
|
||||
return post, err
|
||||
}
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user