Update Mattermost to v5.4
This commit is contained in:
parent
b9e17a1c5f
commit
e30e2613a4
26 changed files with 4888 additions and 4204 deletions
4391
build/manifest/vendor/github.com/mattermost/mattermost-server/NOTICE.txt
generated
vendored
4391
build/manifest/vendor/github.com/mattermost/mattermost-server/NOTICE.txt
generated
vendored
File diff suppressed because it is too large
Load diff
2
build/manifest/vendor/github.com/mattermost/mattermost-server/model/authorize.go
generated
vendored
2
build/manifest/vendor/github.com/mattermost/mattermost-server/model/authorize.go
generated
vendored
|
@ -90,7 +90,7 @@ func (ar *AuthorizeRequest) IsValid() *AppError {
|
|||
return NewAppError("AuthData.IsValid", "model.authorize.is_valid.redirect_uri.app_error", nil, "client_id="+ar.ClientId, http.StatusBadRequest)
|
||||
}
|
||||
|
||||
if len(ar.State) > 128 {
|
||||
if len(ar.State) > 1024 {
|
||||
return NewAppError("AuthData.IsValid", "model.authorize.is_valid.state.app_error", nil, "client_id="+ar.ClientId, http.StatusBadRequest)
|
||||
}
|
||||
|
||||
|
|
6
build/manifest/vendor/github.com/mattermost/mattermost-server/model/channel.go
generated
vendored
6
build/manifest/vendor/github.com/mattermost/mattermost-server/model/channel.go
generated
vendored
|
@ -57,6 +57,12 @@ type ChannelPatch struct {
|
|||
Purpose *string `json:"purpose"`
|
||||
}
|
||||
|
||||
type ChannelForExport struct {
|
||||
Channel
|
||||
TeamName string
|
||||
SchemeName *string
|
||||
}
|
||||
|
||||
func (o *Channel) DeepCopy() *Channel {
|
||||
copy := *o
|
||||
if copy.SchemeId != nil {
|
||||
|
|
|
@ -43,6 +43,11 @@ type ChannelMember struct {
|
|||
|
||||
type ChannelMembers []ChannelMember
|
||||
|
||||
type ChannelMemberForExport struct {
|
||||
ChannelMember
|
||||
ChannelName string
|
||||
}
|
||||
|
||||
func (o *ChannelMembers) ToJson() string {
|
||||
if b, err := json.Marshal(o); err != nil {
|
||||
return "[]"
|
||||
|
|
65
build/manifest/vendor/github.com/mattermost/mattermost-server/model/client4.go
generated
vendored
65
build/manifest/vendor/github.com/mattermost/mattermost-server/model/client4.go
generated
vendored
|
@ -401,6 +401,14 @@ func (c *Client4) GetRedirectLocationRoute() string {
|
|||
return fmt.Sprintf("/redirect_location")
|
||||
}
|
||||
|
||||
func (c *Client4) GetRegisterTermsOfServiceRoute(userId string) string {
|
||||
return c.GetUserRoute(userId) + "/terms_of_service"
|
||||
}
|
||||
|
||||
func (c *Client4) GetTermsOfServiceRoute() string {
|
||||
return "/terms_of_service"
|
||||
}
|
||||
|
||||
func (c *Client4) DoApiGet(url string, etag string) (*http.Response, *AppError) {
|
||||
return c.DoApiRequest(http.MethodGet, c.ApiUrl+url, "", etag)
|
||||
}
|
||||
|
@ -1961,6 +1969,17 @@ func (c *Client4) AutocompleteChannelsForTeam(teamId, name string) (*ChannelList
|
|||
}
|
||||
}
|
||||
|
||||
// AutocompleteChannelsForTeamForSearch will return an ordered list of your channels autocomplete suggestions
|
||||
func (c *Client4) AutocompleteChannelsForTeamForSearch(teamId, name string) (*ChannelList, *Response) {
|
||||
query := fmt.Sprintf("?name=%v", name)
|
||||
if r, err := c.DoApiGet(c.GetChannelsForTeamRoute(teamId)+"/search_autocomplete"+query, ""); err != nil {
|
||||
return nil, BuildErrorResponse(r, err)
|
||||
} else {
|
||||
defer closeBody(r)
|
||||
return ChannelListFromJson(r.Body), BuildResponse(r)
|
||||
}
|
||||
}
|
||||
|
||||
// Post Section
|
||||
|
||||
// CreatePost creates a post based on the provided post struct.
|
||||
|
@ -2157,17 +2176,6 @@ func (c *Client4) SearchPostsWithParams(teamId string, params *SearchParameter)
|
|||
}
|
||||
}
|
||||
|
||||
// SearchPosts returns any posts with matching terms string including deleted channels.
|
||||
func (c *Client4) SearchPostsIncludeDeletedChannels(teamId string, terms string, isOrSearch bool) (*PostList, *Response) {
|
||||
requestBody := map[string]interface{}{"terms": terms, "is_or_search": isOrSearch}
|
||||
if r, err := c.DoApiPost(c.GetTeamRoute(teamId)+"/posts/search?include_deleted_channels=true", StringInterfaceToJson(requestBody)); err != nil {
|
||||
return nil, BuildErrorResponse(r, err)
|
||||
} else {
|
||||
defer closeBody(r)
|
||||
return PostListFromJson(r.Body), BuildResponse(r)
|
||||
}
|
||||
}
|
||||
|
||||
// SearchPosts returns any posts with matching terms string, including .
|
||||
func (c *Client4) SearchPostsWithMatches(teamId string, terms string, isOrSearch bool) (*PostSearchResults, *Response) {
|
||||
requestBody := map[string]interface{}{"terms": terms, "is_or_search": isOrSearch}
|
||||
|
@ -3794,3 +3802,38 @@ func (c *Client4) GetRedirectLocation(urlParam, etag string) (string, *Response)
|
|||
return MapFromJson(r.Body)["location"], BuildResponse(r)
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Client4) RegisteTermsOfServiceAction(userId, termsOfServiceId string, accepted bool) (*bool, *Response) {
|
||||
url := c.GetRegisterTermsOfServiceRoute(userId)
|
||||
data := map[string]interface{}{"termsOfServiceId": termsOfServiceId, "accepted": accepted}
|
||||
|
||||
if r, err := c.DoApiPost(url, StringInterfaceToJson(data)); err != nil {
|
||||
return nil, BuildErrorResponse(r, err)
|
||||
} else {
|
||||
defer closeBody(r)
|
||||
return NewBool(CheckStatusOK(r)), BuildResponse(r)
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Client4) GetTermsOfService(etag string) (*TermsOfService, *Response) {
|
||||
url := c.GetTermsOfServiceRoute()
|
||||
|
||||
if r, err := c.DoApiGet(url, etag); err != nil {
|
||||
return nil, BuildErrorResponse(r, err)
|
||||
} else {
|
||||
defer closeBody(r)
|
||||
return TermsOfServiceFromJson(r.Body), BuildResponse(r)
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Client4) CreateTermsOfService(text, userId string) (*TermsOfService, *Response) {
|
||||
url := c.GetTermsOfServiceRoute()
|
||||
|
||||
data := map[string]string{"text": text}
|
||||
if r, err := c.DoApiPost(url, MapToJson(data)); err != nil {
|
||||
return nil, BuildErrorResponse(r, err)
|
||||
} else {
|
||||
defer closeBody(r)
|
||||
return TermsOfServiceFromJson(r.Body), BuildResponse(r)
|
||||
}
|
||||
}
|
||||
|
|
44
build/manifest/vendor/github.com/mattermost/mattermost-server/model/config.go
generated
vendored
44
build/manifest/vendor/github.com/mattermost/mattermost-server/model/config.go
generated
vendored
|
@ -644,16 +644,17 @@ type SSOSettings struct {
|
|||
}
|
||||
|
||||
type SqlSettings struct {
|
||||
DriverName *string
|
||||
DataSource *string
|
||||
DataSourceReplicas []string
|
||||
DataSourceSearchReplicas []string
|
||||
MaxIdleConns *int
|
||||
ConnMaxLifetimeMilliseconds *int
|
||||
MaxOpenConns *int
|
||||
Trace bool
|
||||
AtRestEncryptKey string
|
||||
QueryTimeout *int
|
||||
DriverName *string
|
||||
DataSource *string
|
||||
DataSourceReplicas []string
|
||||
DataSourceSearchReplicas []string
|
||||
MaxIdleConns *int
|
||||
ConnMaxLifetimeMilliseconds *int
|
||||
MaxOpenConns *int
|
||||
Trace bool
|
||||
AtRestEncryptKey string
|
||||
QueryTimeout *int
|
||||
EnablePublicChannelsMaterialization *bool
|
||||
}
|
||||
|
||||
func (s *SqlSettings) SetDefaults() {
|
||||
|
@ -684,6 +685,10 @@ func (s *SqlSettings) SetDefaults() {
|
|||
if s.QueryTimeout == nil {
|
||||
s.QueryTimeout = NewInt(30)
|
||||
}
|
||||
|
||||
if s.EnablePublicChannelsMaterialization == nil {
|
||||
s.EnablePublicChannelsMaterialization = NewBool(true)
|
||||
}
|
||||
}
|
||||
|
||||
type LogSettings struct {
|
||||
|
@ -991,12 +996,13 @@ type PrivacySettings struct {
|
|||
}
|
||||
|
||||
type SupportSettings struct {
|
||||
TermsOfServiceLink *string
|
||||
PrivacyPolicyLink *string
|
||||
AboutLink *string
|
||||
HelpLink *string
|
||||
ReportAProblemLink *string
|
||||
SupportEmail *string
|
||||
TermsOfServiceLink *string
|
||||
PrivacyPolicyLink *string
|
||||
AboutLink *string
|
||||
HelpLink *string
|
||||
ReportAProblemLink *string
|
||||
SupportEmail *string
|
||||
CustomTermsOfServiceEnabled *bool
|
||||
}
|
||||
|
||||
func (s *SupportSettings) SetDefaults() {
|
||||
|
@ -1043,6 +1049,10 @@ func (s *SupportSettings) SetDefaults() {
|
|||
if s.SupportEmail == nil {
|
||||
s.SupportEmail = NewString(SUPPORT_SETTINGS_DEFAULT_SUPPORT_EMAIL)
|
||||
}
|
||||
|
||||
if s.CustomTermsOfServiceEnabled == nil {
|
||||
s.CustomTermsOfServiceEnabled = NewBool(false)
|
||||
}
|
||||
}
|
||||
|
||||
type AnnouncementSettings struct {
|
||||
|
@ -2370,7 +2380,7 @@ func (ss *ServiceSettings) isValid() *AppError {
|
|||
}
|
||||
}
|
||||
|
||||
host, port, err := net.SplitHostPort(*ss.ListenAddress)
|
||||
host, port, _ := net.SplitHostPort(*ss.ListenAddress)
|
||||
var isValidHost bool
|
||||
if host == "" {
|
||||
isValidHost = true
|
||||
|
|
|
@ -93,7 +93,7 @@ func (o *IncomingWebhook) IsValid() *AppError {
|
|||
return NewAppError("IncomingWebhook.IsValid", "model.incoming_hook.display_name.app_error", nil, "", http.StatusBadRequest)
|
||||
}
|
||||
|
||||
if len(o.Description) > 128 {
|
||||
if len(o.Description) > 500 {
|
||||
return NewAppError("IncomingWebhook.IsValid", "model.incoming_hook.description.app_error", nil, "", http.StatusBadRequest)
|
||||
}
|
||||
|
||||
|
|
5
build/manifest/vendor/github.com/mattermost/mattermost-server/model/license.go
generated
vendored
5
build/manifest/vendor/github.com/mattermost/mattermost-server/model/license.go
generated
vendored
|
@ -55,6 +55,7 @@ type Features struct {
|
|||
DataRetention *bool `json:"data_retention"`
|
||||
MessageExport *bool `json:"message_export"`
|
||||
CustomPermissionsSchemes *bool `json:"custom_permissions_schemes"`
|
||||
CustomTermsOfService *bool `json:"custom_terms_of_service"`
|
||||
|
||||
// after we enabled more features for webrtc we'll need to control them with this
|
||||
FutureFeatures *bool `json:"future_features"`
|
||||
|
@ -152,6 +153,10 @@ func (f *Features) SetDefaults() {
|
|||
if f.CustomPermissionsSchemes == nil {
|
||||
f.CustomPermissionsSchemes = NewBool(*f.FutureFeatures)
|
||||
}
|
||||
|
||||
if f.CustomTermsOfService == nil {
|
||||
f.CustomTermsOfService = NewBool(*f.FutureFeatures)
|
||||
}
|
||||
}
|
||||
|
||||
func (l *License) IsExpired() bool {
|
||||
|
|
|
@ -171,7 +171,7 @@ func (o *OutgoingWebhook) IsValid() *AppError {
|
|||
return NewAppError("OutgoingWebhook.IsValid", "model.outgoing_hook.is_valid.display_name.app_error", nil, "", http.StatusBadRequest)
|
||||
}
|
||||
|
||||
if len(o.Description) > 128 {
|
||||
if len(o.Description) > 500 {
|
||||
return NewAppError("OutgoingWebhook.IsValid", "model.outgoing_hook.is_valid.description.app_error", nil, "", http.StatusBadRequest)
|
||||
}
|
||||
|
||||
|
|
24
build/manifest/vendor/github.com/mattermost/mattermost-server/model/post.go
generated
vendored
24
build/manifest/vendor/github.com/mattermost/mattermost-server/model/post.go
generated
vendored
|
@ -97,9 +97,12 @@ type PostPatch struct {
|
|||
}
|
||||
|
||||
type SearchParameter struct {
|
||||
Terms *string `json:"terms"`
|
||||
IsOrSearch *bool `json:"is_or_search"`
|
||||
TimeZoneOffset *int `json:"time_zone_offset"`
|
||||
Terms *string `json:"terms"`
|
||||
IsOrSearch *bool `json:"is_or_search"`
|
||||
TimeZoneOffset *int `json:"time_zone_offset"`
|
||||
Page *int `json:"page"`
|
||||
PerPage *int `json:"per_page"`
|
||||
IncludeDeletedChannels *bool `json:"include_deleted_channels"`
|
||||
}
|
||||
|
||||
func (o *PostPatch) WithRewrittenImageURLs(f func(string) string) *PostPatch {
|
||||
|
@ -110,6 +113,19 @@ func (o *PostPatch) WithRewrittenImageURLs(f func(string) string) *PostPatch {
|
|||
return ©
|
||||
}
|
||||
|
||||
type PostForExport struct {
|
||||
Post
|
||||
TeamName string
|
||||
ChannelName string
|
||||
Username string
|
||||
ReplyCount int
|
||||
}
|
||||
|
||||
type ReplyForExport struct {
|
||||
Post
|
||||
Username string
|
||||
}
|
||||
|
||||
type PostForIndexing struct {
|
||||
Post
|
||||
TeamId string `json:"team_id"`
|
||||
|
@ -141,6 +157,8 @@ type PostActionIntegration struct {
|
|||
|
||||
type PostActionIntegrationRequest struct {
|
||||
UserId string `json:"user_id"`
|
||||
ChannelId string `json:"channel_id"`
|
||||
TeamId string `json:"team_id"`
|
||||
PostId string `json:"post_id"`
|
||||
Type string `json:"type"`
|
||||
DataSource string `json:"data_source"`
|
||||
|
|
5
build/manifest/vendor/github.com/mattermost/mattermost-server/model/preference.go
generated
vendored
5
build/manifest/vendor/github.com/mattermost/mattermost-server/model/preference.go
generated
vendored
|
@ -18,9 +18,14 @@ const (
|
|||
PREFERENCE_CATEGORY_ADVANCED_SETTINGS = "advanced_settings"
|
||||
PREFERENCE_CATEGORY_FLAGGED_POST = "flagged_post"
|
||||
PREFERENCE_CATEGORY_FAVORITE_CHANNEL = "favorite_channel"
|
||||
PREFERENCE_CATEGORY_SIDEBAR_SETTINGS = "sidebar_settings"
|
||||
|
||||
PREFERENCE_CATEGORY_DISPLAY_SETTINGS = "display_settings"
|
||||
PREFERENCE_NAME_CHANNEL_DISPLAY_MODE = "channel_display_mode"
|
||||
PREFERENCE_NAME_COLLAPSE_SETTING = "collapse_previews"
|
||||
PREFERENCE_NAME_MESSAGE_DISPLAY = "message_display"
|
||||
PREFERENCE_NAME_NAME_FORMAT = "name_format"
|
||||
PREFERENCE_NAME_USE_MILITARY_TIME = "use_military_time"
|
||||
|
||||
PREFERENCE_CATEGORY_THEME = "theme"
|
||||
// the name for theme props is the team id
|
||||
|
|
2
build/manifest/vendor/github.com/mattermost/mattermost-server/model/role.go
generated
vendored
2
build/manifest/vendor/github.com/mattermost/mattermost-server/model/role.go
generated
vendored
|
@ -243,7 +243,6 @@ func MakeDefaultRoles() map[string]*Role {
|
|||
DisplayName: "authentication.roles.team_admin.name",
|
||||
Description: "authentication.roles.team_admin.description",
|
||||
Permissions: []string{
|
||||
PERMISSION_EDIT_OTHERS_POSTS.Id,
|
||||
PERMISSION_REMOVE_USER_FROM_TEAM.Id,
|
||||
PERMISSION_MANAGE_TEAM.Id,
|
||||
PERMISSION_IMPORT_TEAM.Id,
|
||||
|
@ -332,6 +331,7 @@ func MakeDefaultRoles() map[string]*Role {
|
|||
PERMISSION_MANAGE_SYSTEM_WIDE_OAUTH.Id,
|
||||
PERMISSION_MANAGE_OTHERS_WEBHOOKS.Id,
|
||||
PERMISSION_EDIT_OTHER_USERS.Id,
|
||||
PERMISSION_EDIT_OTHERS_POSTS.Id,
|
||||
PERMISSION_MANAGE_OAUTH.Id,
|
||||
PERMISSION_INVITE_USER.Id,
|
||||
PERMISSION_DELETE_POST.Id,
|
||||
|
|
18
build/manifest/vendor/github.com/mattermost/mattermost-server/model/search_params.go
generated
vendored
18
build/manifest/vendor/github.com/mattermost/mattermost-server/model/search_params.go
generated
vendored
|
@ -27,7 +27,11 @@ type SearchParams struct {
|
|||
|
||||
// Returns the epoch timestamp of the start of the day specified by SearchParams.AfterDate
|
||||
func (p *SearchParams) GetAfterDateMillis() int64 {
|
||||
date := ParseDateFilterToTime(p.AfterDate)
|
||||
date, err := time.Parse("2006-01-02", PadDateStringZeros(p.AfterDate))
|
||||
if err != nil {
|
||||
date = time.Now()
|
||||
}
|
||||
|
||||
// travel forward 1 day
|
||||
oneDay := time.Hour * 24
|
||||
afterDate := date.Add(oneDay)
|
||||
|
@ -36,7 +40,11 @@ func (p *SearchParams) GetAfterDateMillis() int64 {
|
|||
|
||||
// Returns the epoch timestamp of the end of the day specified by SearchParams.BeforeDate
|
||||
func (p *SearchParams) GetBeforeDateMillis() int64 {
|
||||
date := ParseDateFilterToTime(p.BeforeDate)
|
||||
date, err := time.Parse("2006-01-02", PadDateStringZeros(p.BeforeDate))
|
||||
if err != nil {
|
||||
return 0
|
||||
}
|
||||
|
||||
// travel back 1 day
|
||||
oneDay := time.Hour * -24
|
||||
beforeDate := date.Add(oneDay)
|
||||
|
@ -45,7 +53,11 @@ func (p *SearchParams) GetBeforeDateMillis() int64 {
|
|||
|
||||
// Returns the epoch timestamps of the start and end of the day specified by SearchParams.OnDate
|
||||
func (p *SearchParams) GetOnDateMillis() (int64, int64) {
|
||||
date := ParseDateFilterToTime(p.OnDate)
|
||||
date, err := time.Parse("2006-01-02", PadDateStringZeros(p.OnDate))
|
||||
if err != nil {
|
||||
return 0, 0
|
||||
}
|
||||
|
||||
return GetStartOfDayMillis(date, p.TimeZoneOffset), GetEndOfDayMillis(date, p.TimeZoneOffset)
|
||||
}
|
||||
|
||||
|
|
25
build/manifest/vendor/github.com/mattermost/mattermost-server/model/slack_attachment.go
generated
vendored
25
build/manifest/vendor/github.com/mattermost/mattermost-server/model/slack_attachment.go
generated
vendored
|
@ -5,8 +5,11 @@ package model
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"regexp"
|
||||
)
|
||||
|
||||
var linkWithTextRegex = regexp.MustCompile(`<([^<\|]+)\|([^>]+)>`)
|
||||
|
||||
type SlackAttachment struct {
|
||||
Id int64 `json:"id"`
|
||||
Fallback string `json:"fallback"`
|
||||
|
@ -57,3 +60,25 @@ func StringifySlackFieldValue(a []*SlackAttachment) []*SlackAttachment {
|
|||
}
|
||||
return nonNilAttachments
|
||||
}
|
||||
|
||||
// This method only parses and processes the attachments,
|
||||
// all else should be set in the post which is passed
|
||||
func ParseSlackAttachment(post *Post, attachments []*SlackAttachment) {
|
||||
post.Type = POST_SLACK_ATTACHMENT
|
||||
|
||||
for _, attachment := range attachments {
|
||||
attachment.Text = ParseSlackLinksToMarkdown(attachment.Text)
|
||||
attachment.Pretext = ParseSlackLinksToMarkdown(attachment.Pretext)
|
||||
|
||||
for _, field := range attachment.Fields {
|
||||
if value, ok := field.Value.(string); ok {
|
||||
field.Value = ParseSlackLinksToMarkdown(value)
|
||||
}
|
||||
}
|
||||
}
|
||||
post.AddProp("attachments", attachments)
|
||||
}
|
||||
|
||||
func ParseSlackLinksToMarkdown(text string) string {
|
||||
return linkWithTextRegex.ReplaceAllString(text, "[${2}](${1})")
|
||||
}
|
||||
|
|
5
build/manifest/vendor/github.com/mattermost/mattermost-server/model/team.go
generated
vendored
5
build/manifest/vendor/github.com/mattermost/mattermost-server/model/team.go
generated
vendored
|
@ -52,6 +52,11 @@ type TeamPatch struct {
|
|||
AllowOpenInvite *bool `json:"allow_open_invite"`
|
||||
}
|
||||
|
||||
type TeamForExport struct {
|
||||
Team
|
||||
SchemeName *string
|
||||
}
|
||||
|
||||
type Invites struct {
|
||||
Invites []map[string]string `json:"invites"`
|
||||
}
|
||||
|
|
5
build/manifest/vendor/github.com/mattermost/mattermost-server/model/team_member.go
generated
vendored
5
build/manifest/vendor/github.com/mattermost/mattermost-server/model/team_member.go
generated
vendored
|
@ -26,6 +26,11 @@ type TeamUnread struct {
|
|||
MentionCount int64 `json:"mention_count"`
|
||||
}
|
||||
|
||||
type TeamMemberForExport struct {
|
||||
TeamMember
|
||||
TeamName string
|
||||
}
|
||||
|
||||
func (o *TeamMember) ToJson() string {
|
||||
b, _ := json.Marshal(o)
|
||||
return string(b)
|
||||
|
|
70
build/manifest/vendor/github.com/mattermost/mattermost-server/model/terms_of_service.go
generated
vendored
Normal file
70
build/manifest/vendor/github.com/mattermost/mattermost-server/model/terms_of_service.go
generated
vendored
Normal file
|
@ -0,0 +1,70 @@
|
|||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See License.txt for license information.
|
||||
|
||||
package model
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"unicode/utf8"
|
||||
)
|
||||
|
||||
// we only ever need the latest version of terms of service
|
||||
const TERMS_OF_SERVICE_CACHE_SIZE = 1
|
||||
|
||||
type TermsOfService struct {
|
||||
Id string `json:"id"`
|
||||
CreateAt int64 `json:"create_at"`
|
||||
UserId string `json:"user_id"`
|
||||
Text string `json:"text"`
|
||||
}
|
||||
|
||||
func (t *TermsOfService) IsValid() *AppError {
|
||||
if len(t.Id) != 26 {
|
||||
return InvalidTermsOfServiceError("id", "")
|
||||
}
|
||||
|
||||
if t.CreateAt == 0 {
|
||||
return InvalidTermsOfServiceError("create_at", t.Id)
|
||||
}
|
||||
|
||||
if len(t.UserId) != 26 {
|
||||
return InvalidTermsOfServiceError("user_id", t.Id)
|
||||
}
|
||||
|
||||
if utf8.RuneCountInString(t.Text) > POST_MESSAGE_MAX_RUNES_V2 {
|
||||
return InvalidTermsOfServiceError("text", t.Id)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (t *TermsOfService) ToJson() string {
|
||||
b, _ := json.Marshal(t)
|
||||
return string(b)
|
||||
}
|
||||
|
||||
func TermsOfServiceFromJson(data io.Reader) *TermsOfService {
|
||||
var termsOfService *TermsOfService
|
||||
json.NewDecoder(data).Decode(&termsOfService)
|
||||
return termsOfService
|
||||
}
|
||||
|
||||
func InvalidTermsOfServiceError(fieldName string, termsOfServiceId string) *AppError {
|
||||
id := fmt.Sprintf("model.terms_of_service.is_valid.%s.app_error", fieldName)
|
||||
details := ""
|
||||
if termsOfServiceId != "" {
|
||||
details = "terms_of_service_id=" + termsOfServiceId
|
||||
}
|
||||
return NewAppError("TermsOfServiceStore.IsValid", id, map[string]interface{}{"MaxLength": POST_MESSAGE_MAX_RUNES_V2}, details, http.StatusBadRequest)
|
||||
}
|
||||
|
||||
func (t *TermsOfService) PreSave() {
|
||||
if t.Id == "" {
|
||||
t.Id = NewId()
|
||||
}
|
||||
|
||||
t.CreateAt = GetMillis()
|
||||
}
|
53
build/manifest/vendor/github.com/mattermost/mattermost-server/model/user.go
generated
vendored
53
build/manifest/vendor/github.com/mattermost/mattermost-server/model/user.go
generated
vendored
|
@ -48,32 +48,33 @@ const (
|
|||
)
|
||||
|
||||
type User struct {
|
||||
Id string `json:"id"`
|
||||
CreateAt int64 `json:"create_at,omitempty"`
|
||||
UpdateAt int64 `json:"update_at,omitempty"`
|
||||
DeleteAt int64 `json:"delete_at"`
|
||||
Username string `json:"username"`
|
||||
Password string `json:"password,omitempty"`
|
||||
AuthData *string `json:"auth_data,omitempty"`
|
||||
AuthService string `json:"auth_service"`
|
||||
Email string `json:"email"`
|
||||
EmailVerified bool `json:"email_verified,omitempty"`
|
||||
Nickname string `json:"nickname"`
|
||||
FirstName string `json:"first_name"`
|
||||
LastName string `json:"last_name"`
|
||||
Position string `json:"position"`
|
||||
Roles string `json:"roles"`
|
||||
AllowMarketing bool `json:"allow_marketing,omitempty"`
|
||||
Props StringMap `json:"props,omitempty"`
|
||||
NotifyProps StringMap `json:"notify_props,omitempty"`
|
||||
LastPasswordUpdate int64 `json:"last_password_update,omitempty"`
|
||||
LastPictureUpdate int64 `json:"last_picture_update,omitempty"`
|
||||
FailedAttempts int `json:"failed_attempts,omitempty"`
|
||||
Locale string `json:"locale"`
|
||||
Timezone StringMap `json:"timezone"`
|
||||
MfaActive bool `json:"mfa_active,omitempty"`
|
||||
MfaSecret string `json:"mfa_secret,omitempty"`
|
||||
LastActivityAt int64 `db:"-" json:"last_activity_at,omitempty"`
|
||||
Id string `json:"id"`
|
||||
CreateAt int64 `json:"create_at,omitempty"`
|
||||
UpdateAt int64 `json:"update_at,omitempty"`
|
||||
DeleteAt int64 `json:"delete_at"`
|
||||
Username string `json:"username"`
|
||||
Password string `json:"password,omitempty"`
|
||||
AuthData *string `json:"auth_data,omitempty"`
|
||||
AuthService string `json:"auth_service"`
|
||||
Email string `json:"email"`
|
||||
EmailVerified bool `json:"email_verified,omitempty"`
|
||||
Nickname string `json:"nickname"`
|
||||
FirstName string `json:"first_name"`
|
||||
LastName string `json:"last_name"`
|
||||
Position string `json:"position"`
|
||||
Roles string `json:"roles"`
|
||||
AllowMarketing bool `json:"allow_marketing,omitempty"`
|
||||
Props StringMap `json:"props,omitempty"`
|
||||
NotifyProps StringMap `json:"notify_props,omitempty"`
|
||||
LastPasswordUpdate int64 `json:"last_password_update,omitempty"`
|
||||
LastPictureUpdate int64 `json:"last_picture_update,omitempty"`
|
||||
FailedAttempts int `json:"failed_attempts,omitempty"`
|
||||
Locale string `json:"locale"`
|
||||
Timezone StringMap `json:"timezone"`
|
||||
MfaActive bool `json:"mfa_active,omitempty"`
|
||||
MfaSecret string `json:"mfa_secret,omitempty"`
|
||||
LastActivityAt int64 `db:"-" json:"last_activity_at,omitempty"`
|
||||
AcceptedTermsOfServiceId string `json:"accepted_terms_of_service_id,omitempty"` // TODO remove this field when new TOS user action table is created
|
||||
}
|
||||
|
||||
type UserPatch struct {
|
||||
|
|
19
build/manifest/vendor/github.com/mattermost/mattermost-server/model/utils.go
generated
vendored
19
build/manifest/vendor/github.com/mattermost/mattermost-server/model/utils.go
generated
vendored
|
@ -141,26 +141,17 @@ func NewRandomString(length int) string {
|
|||
return b.String()
|
||||
}
|
||||
|
||||
// GetMillis is a convience method to get milliseconds since epoch.
|
||||
// GetMillis is a convenience method to get milliseconds since epoch.
|
||||
func GetMillis() int64 {
|
||||
return time.Now().UnixNano() / int64(time.Millisecond)
|
||||
}
|
||||
|
||||
// GetMillisForTime is a convience method to get milliseconds since epoch for provided Time.
|
||||
// GetMillisForTime is a convenience method to get milliseconds since epoch for provided Time.
|
||||
func GetMillisForTime(thisTime time.Time) int64 {
|
||||
return thisTime.UnixNano() / int64(time.Millisecond)
|
||||
}
|
||||
|
||||
// ParseDateFilterToTime is a convience method to get Time from string
|
||||
func ParseDateFilterToTime(filterString string) time.Time {
|
||||
resultTime, err := time.Parse("2006-01-02", PadDateStringZeros(filterString))
|
||||
if err != nil {
|
||||
return time.Now()
|
||||
}
|
||||
return resultTime
|
||||
}
|
||||
|
||||
// PadDateStringZeros is a convience method to pad 2 digit date parts with zeros to meet ISO 8601 format
|
||||
// PadDateStringZeros is a convenience method to pad 2 digit date parts with zeros to meet ISO 8601 format
|
||||
func PadDateStringZeros(dateString string) string {
|
||||
parts := strings.Split(dateString, "-")
|
||||
for index, part := range parts {
|
||||
|
@ -172,14 +163,14 @@ func PadDateStringZeros(dateString string) string {
|
|||
return dateString
|
||||
}
|
||||
|
||||
// GetStartOfDayMillis is a convience method to get milliseconds since epoch for provided date's start of day
|
||||
// GetStartOfDayMillis is a convenience method to get milliseconds since epoch for provided date's start of day
|
||||
func GetStartOfDayMillis(thisTime time.Time, timeZoneOffset int) int64 {
|
||||
localSearchTimeZone := time.FixedZone("Local Search Time Zone", timeZoneOffset)
|
||||
resultTime := time.Date(thisTime.Year(), thisTime.Month(), thisTime.Day(), 0, 0, 0, 0, localSearchTimeZone)
|
||||
return GetMillisForTime(resultTime)
|
||||
}
|
||||
|
||||
// GetEndOfDayMillis is a convience method to get milliseconds since epoch for provided date's end of day
|
||||
// GetEndOfDayMillis is a convenience method to get milliseconds since epoch for provided date's end of day
|
||||
func GetEndOfDayMillis(thisTime time.Time, timeZoneOffset int) int64 {
|
||||
localSearchTimeZone := time.FixedZone("Local Search Time Zone", timeZoneOffset)
|
||||
resultTime := time.Date(thisTime.Year(), thisTime.Month(), thisTime.Day(), 23, 59, 59, 999999999, localSearchTimeZone)
|
||||
|
|
1
build/manifest/vendor/github.com/mattermost/mattermost-server/model/version.go
generated
vendored
1
build/manifest/vendor/github.com/mattermost/mattermost-server/model/version.go
generated
vendored
|
@ -13,6 +13,7 @@ import (
|
|||
// It should be maintained in chronological order with most current
|
||||
// release at the front of the list.
|
||||
var versions = []string{
|
||||
"5.4.0",
|
||||
"5.3.0",
|
||||
"5.2.0",
|
||||
"5.1.0",
|
||||
|
|
|
@ -5,7 +5,7 @@ count=0
|
|||
for fileType in GoFiles; do
|
||||
for file in `go list -f $'{{range .GoFiles}}{{$.Dir}}/{{.}}\n{{end}}' "$@"`; do
|
||||
case $file in
|
||||
*/utils/lru.go|*/store/storetest/mocks/*|*/app/plugin/jira/plugin_*|*/plugin/plugintest/*|*/app/plugin/zoom/plugin_*)
|
||||
*/utils/lru.go|*/store/storetest/mocks/*|*/services/*/mocks/*|*/app/plugin/jira/plugin_*|*/plugin/plugintest/*|*/app/plugin/zoom/plugin_*)
|
||||
# Third-party, doesn't require a header.
|
||||
;;
|
||||
*)
|
||||
|
|
4198
build/manifest/vendor/github.com/mattermost/mattermost-server/utils/markdown/html_entities.go
generated
vendored
4198
build/manifest/vendor/github.com/mattermost/mattermost-server/utils/markdown/html_entities.go
generated
vendored
File diff suppressed because it is too large
Load diff
Reference in a new issue