summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/mattermost/mattermost-server/v5/model/post.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2020-10-19 23:40:00 +0200
committerGitHub <noreply@github.com>2020-10-19 23:40:00 +0200
commit075a84427f6332aab707d283ad770d69f8816032 (patch)
tree0ff9f56a057919f3fe968e57f6f0b1c0d1f85078 /vendor/github.com/mattermost/mattermost-server/v5/model/post.go
parent950f2759bd2b20aa0bdedc3dc9a74d0dafb606d8 (diff)
downloadmatterbridge-msglm-075a84427f6332aab707d283ad770d69f8816032.tar.gz
matterbridge-msglm-075a84427f6332aab707d283ad770d69f8816032.tar.bz2
matterbridge-msglm-075a84427f6332aab707d283ad770d69f8816032.zip
Update vendor (#1265)
Diffstat (limited to 'vendor/github.com/mattermost/mattermost-server/v5/model/post.go')
-rw-r--r--vendor/github.com/mattermost/mattermost-server/v5/model/post.go16
1 files changed, 10 insertions, 6 deletions
diff --git a/vendor/github.com/mattermost/mattermost-server/v5/model/post.go b/vendor/github.com/mattermost/mattermost-server/v5/model/post.go
index 817ca08a..6e29ba3e 100644
--- a/vendor/github.com/mattermost/mattermost-server/v5/model/post.go
+++ b/vendor/github.com/mattermost/mattermost-server/v5/model/post.go
@@ -64,6 +64,7 @@ const (
POST_PROPS_MENTION_HIGHLIGHT_DISABLED = "mentionHighlightDisabled"
POST_PROPS_GROUP_HIGHLIGHT_DISABLED = "disable_group_highlight"
+ POST_SYSTEM_WARN_METRIC_STATUS = "warn_metric_status"
)
var AT_MENTION_PATTEN = regexp.MustCompile(`\B@`)
@@ -312,7 +313,8 @@ func (o *Post) IsValid(maxPostSize int) *AppError {
POST_CHANNEL_RESTORED,
POST_CHANGE_CHANNEL_PRIVACY,
POST_ME,
- POST_ADD_BOT_TEAMS_CHANNELS:
+ POST_ADD_BOT_TEAMS_CHANNELS,
+ POST_SYSTEM_WARN_METRIC_STATUS:
default:
if !strings.HasPrefix(o.Type, POST_CUSTOM_TYPE_PREFIX) {
return NewAppError("Post.IsValid", "model.post.is_valid.type.app_error", nil, "id="+o.Type, http.StatusBadRequest)
@@ -495,15 +497,14 @@ func (o *SearchParameter) SearchParameterToJson() string {
return string(b)
}
-func SearchParameterFromJson(data io.Reader) *SearchParameter {
+func SearchParameterFromJson(data io.Reader) (*SearchParameter, error) {
decoder := json.NewDecoder(data)
var searchParam SearchParameter
- err := decoder.Decode(&searchParam)
- if err != nil {
- return nil
+ if err := decoder.Decode(&searchParam); err != nil {
+ return nil, err
}
- return &searchParam
+ return &searchParam, nil
}
func (o *Post) ChannelMentions() []string {
@@ -521,6 +522,9 @@ func (o *Post) DisableMentionHighlights() string {
// DisableMentionHighlights disables mention highlighting for a post patch if required.
func (o *PostPatch) DisableMentionHighlights() {
+ if o.Message == nil {
+ return
+ }
if _, hasMentions := findAtChannelMention(*o.Message); hasMentions {
if o.Props == nil {
o.Props = &StringInterface{}