mirror of
https://github.com/cwinfo/matterbridge.git
synced 2025-07-05 23:04:03 +00:00
Update dependencies (#1610)
* Update dependencies * Update module to go 1.17
This commit is contained in:
40
vendor/github.com/mattermost/mattermost-server/v5/model/reaction.go
generated
vendored
40
vendor/github.com/mattermost/mattermost-server/v5/model/reaction.go
generated
vendored
@ -11,10 +11,13 @@ import (
|
||||
)
|
||||
|
||||
type Reaction struct {
|
||||
UserId string `json:"user_id"`
|
||||
PostId string `json:"post_id"`
|
||||
EmojiName string `json:"emoji_name"`
|
||||
CreateAt int64 `json:"create_at"`
|
||||
UserId string `json:"user_id"`
|
||||
PostId string `json:"post_id"`
|
||||
EmojiName string `json:"emoji_name"`
|
||||
CreateAt int64 `json:"create_at"`
|
||||
UpdateAt int64 `json:"update_at"`
|
||||
DeleteAt int64 `json:"delete_at"`
|
||||
RemoteId *string `json:"remote_id"`
|
||||
}
|
||||
|
||||
func (o *Reaction) ToJson() string {
|
||||
@ -27,9 +30,8 @@ func ReactionFromJson(data io.Reader) *Reaction {
|
||||
|
||||
if err := json.NewDecoder(data).Decode(&o); err != nil {
|
||||
return nil
|
||||
} else {
|
||||
return &o
|
||||
}
|
||||
return &o
|
||||
}
|
||||
|
||||
func ReactionsToJson(o []*Reaction) string {
|
||||
@ -48,9 +50,8 @@ func MapPostIdToReactionsFromJson(data io.Reader) map[string][]*Reaction {
|
||||
var objmap map[string][]*Reaction
|
||||
if err := decoder.Decode(&objmap); err != nil {
|
||||
return make(map[string][]*Reaction)
|
||||
} else {
|
||||
return objmap
|
||||
}
|
||||
return objmap
|
||||
}
|
||||
|
||||
func ReactionsFromJson(data io.Reader) []*Reaction {
|
||||
@ -58,9 +59,8 @@ func ReactionsFromJson(data io.Reader) []*Reaction {
|
||||
|
||||
if err := json.NewDecoder(data).Decode(&o); err != nil {
|
||||
return nil
|
||||
} else {
|
||||
return o
|
||||
}
|
||||
return o
|
||||
}
|
||||
|
||||
func (o *Reaction) IsValid() *AppError {
|
||||
@ -74,7 +74,7 @@ func (o *Reaction) IsValid() *AppError {
|
||||
|
||||
validName := regexp.MustCompile(`^[a-zA-Z0-9\-\+_]+$`)
|
||||
|
||||
if len(o.EmojiName) == 0 || len(o.EmojiName) > EMOJI_NAME_MAX_LENGTH || !validName.MatchString(o.EmojiName) {
|
||||
if o.EmojiName == "" || len(o.EmojiName) > EMOJI_NAME_MAX_LENGTH || !validName.MatchString(o.EmojiName) {
|
||||
return NewAppError("Reaction.IsValid", "model.reaction.is_valid.emoji_name.app_error", nil, "emoji_name="+o.EmojiName, http.StatusBadRequest)
|
||||
}
|
||||
|
||||
@ -82,6 +82,10 @@ func (o *Reaction) IsValid() *AppError {
|
||||
return NewAppError("Reaction.IsValid", "model.reaction.is_valid.create_at.app_error", nil, "", http.StatusBadRequest)
|
||||
}
|
||||
|
||||
if o.UpdateAt == 0 {
|
||||
return NewAppError("Reaction.IsValid", "model.reaction.is_valid.update_at.app_error", nil, "", http.StatusBadRequest)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -89,4 +93,18 @@ func (o *Reaction) PreSave() {
|
||||
if o.CreateAt == 0 {
|
||||
o.CreateAt = GetMillis()
|
||||
}
|
||||
o.UpdateAt = GetMillis()
|
||||
o.DeleteAt = 0
|
||||
|
||||
if o.RemoteId == nil {
|
||||
o.RemoteId = NewString("")
|
||||
}
|
||||
}
|
||||
|
||||
func (o *Reaction) PreUpdate() {
|
||||
o.UpdateAt = GetMillis()
|
||||
|
||||
if o.RemoteId == nil {
|
||||
o.RemoteId = NewString("")
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user