focalboard/server/services/notify/plugindelivery/message.go

25 lines
786 B
Go
Raw Normal View History

2021-09-13 21:36:36 +02:00
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package plugindelivery
import (
"fmt"
"github.com/mattermost/focalboard/server/model"
)
const (
// TODO: localize these when i18n is available.
defCommentTemplate = "@%s mentioned you in a comment on the card [%s](%s) in board [%s](%s)\n> %s"
defDescriptionTemplate = "@%s mentioned you in the card [%s](%s) in board [%s](%s)\n> %s"
2021-09-13 21:36:36 +02:00
)
func formatMessage(author string, extract string, card string, link string, block *model.Block, boardLink string, board string) string {
2021-09-13 21:36:36 +02:00
template := defDescriptionTemplate
2021-10-27 03:11:19 +02:00
if block.Type == model.TypeComment {
2021-09-13 21:36:36 +02:00
template = defCommentTemplate
}
return fmt.Sprintf(template, author, card, link, board, boardLink, extract)
2021-09-13 21:36:36 +02:00
}