commit
8e2e57e1f5
26 changed files with 4888 additions and 4204 deletions
6
build/manifest/Gopkg.lock
generated
6
build/manifest/Gopkg.lock
generated
|
@ -10,7 +10,7 @@
|
|||
revision = "5ed622c449da6d44c3c8329331ff47a9e5844f71"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:92014e65d79685825a5625285c7ea0775ce3bf84845c27726d4f58f3c3087d8b"
|
||||
digest = "1:771649e04a49766e04f498731699e62874ffa2439a071294fde36d61b2db0685"
|
||||
name = "github.com/mattermost/mattermost-server"
|
||||
packages = [
|
||||
"mlog",
|
||||
|
@ -19,8 +19,8 @@
|
|||
"utils/markdown",
|
||||
]
|
||||
pruneopts = "UT"
|
||||
revision = "fd21e53365d504155ab87f9bef60b1ab4faeb38d"
|
||||
version = "v5.3.1"
|
||||
revision = "d5b613cb1bbdaa856fa126e7102d94783b9e80b6"
|
||||
version = "v5.4.0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:07140002dbf37da92090f731b46fa47be4820b82fe5c14a035203b0e813d0ec2"
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
[[constraint]]
|
||||
name = "github.com/mattermost/mattermost-server"
|
||||
version = "~5.3.0"
|
||||
version = "~5.4.0"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/pkg/errors"
|
||||
|
|
4371
build/manifest/vendor/github.com/mattermost/mattermost-server/NOTICE.txt
generated
vendored
4371
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)
|
||||
}
|
||||
}
|
||||
|
|
12
build/manifest/vendor/github.com/mattermost/mattermost-server/model/config.go
generated
vendored
12
build/manifest/vendor/github.com/mattermost/mattermost-server/model/config.go
generated
vendored
|
@ -654,6 +654,7 @@ type SqlSettings struct {
|
|||
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 {
|
||||
|
@ -997,6 +1002,7 @@ type SupportSettings struct {
|
|||
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)
|
||||
}
|
||||
|
||||
|
|
18
build/manifest/vendor/github.com/mattermost/mattermost-server/model/post.go
generated
vendored
18
build/manifest/vendor/github.com/mattermost/mattermost-server/model/post.go
generated
vendored
|
@ -100,6 +100,9 @@ type SearchParameter struct {
|
|||
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()
|
||||
}
|
1
build/manifest/vendor/github.com/mattermost/mattermost-server/model/user.go
generated
vendored
1
build/manifest/vendor/github.com/mattermost/mattermost-server/model/user.go
generated
vendored
|
@ -74,6 +74,7 @@ type User struct {
|
|||
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.
|
||||
;;
|
||||
*)
|
||||
|
|
133
server/Gopkg.lock
generated
133
server/Gopkg.lock
generated
|
@ -2,12 +2,12 @@
|
|||
|
||||
|
||||
[[projects]]
|
||||
digest = "1:b7ffca49e9cfd3dfb04a8e0a59347708c6f78f68476a32c5e0a0edca5d1b258c"
|
||||
name = "github.com/dustin/go-humanize"
|
||||
packages = ["."]
|
||||
digest = "1:ffe9824d294da03b391f44e1ae8281281b4afc1bdaa9588c9097785e3af10cec"
|
||||
name = "github.com/davecgh/go-spew"
|
||||
packages = ["spew"]
|
||||
pruneopts = "NUT"
|
||||
revision = "9f541cc9db5d55bce703bd99987c9d5cb8eea45e"
|
||||
version = "v1.0.0"
|
||||
revision = "8991bc29aa16c548c550c7ff78260e27b9ab7c73"
|
||||
version = "v1.1.1"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:1b91ae0dc69a41d4c2ed23ea5cffb721ea63f5037ca4b81e6d6771fbb8f45129"
|
||||
|
@ -17,14 +17,6 @@
|
|||
revision = "c2828203cd70a50dcccfb2761f8b1f8ceef9a8e9"
|
||||
version = "v1.4.7"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:d32823ccbd16481c42356a1ae7f2284761da19cae3131b554a0b7c086a650292"
|
||||
name = "github.com/go-ini/ini"
|
||||
packages = ["."]
|
||||
pruneopts = "NUT"
|
||||
revision = "7b294651033cd7d9e7f0d9ffa1b75ed1e198e737"
|
||||
version = "v1.38.3"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:63ccdfbd20f7ccd2399d0647a7d100b122f79c13bb83da9660b1598396fd9f62"
|
||||
name = "github.com/golang/protobuf"
|
||||
|
@ -96,22 +88,6 @@
|
|||
pruneopts = "NUT"
|
||||
revision = "7221087c3d281fda5f794e28c2ea4c6e4d5c4558"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:37eb5dfae485ce9985b61640b6ede63f2a58898efdda6a9a94f1794df62f9147"
|
||||
name = "github.com/jaytaylor/html2text"
|
||||
packages = ["."]
|
||||
pruneopts = "NUT"
|
||||
revision = "57d518f124b0cf46ea2021f25a01396b3522e6fb"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:4059c14e87a2de3a434430340521b5feece186c1469eff0834c29a63870de3ed"
|
||||
name = "github.com/konsorten/go-windows-terminal-sequences"
|
||||
packages = ["."]
|
||||
pruneopts = "NUT"
|
||||
revision = "5c8c8bd35d3832f5d134ae1e1e375b69a4d25242"
|
||||
version = "v1.0.1"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:d244f8666a838fe6ad70ec8fe77f50ebc29fdc3331a2729ba5886bef8435d10d"
|
||||
name = "github.com/magiconair/properties"
|
||||
|
@ -121,7 +97,7 @@
|
|||
version = "v1.8.0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:38ba2dacfd4596f2543e168b03af8f514da5fea53ef43af4a7b95368f759bffb"
|
||||
digest = "1:fcaa0c4871e4b49fb30d986e688c069328c042eae6ef89d0ead9882d2d450648"
|
||||
name = "github.com/mattermost/mattermost-server"
|
||||
packages = [
|
||||
"einterfaces",
|
||||
|
@ -133,8 +109,8 @@
|
|||
"utils/markdown",
|
||||
]
|
||||
pruneopts = "NUT"
|
||||
revision = "fd21e53365d504155ab87f9bef60b1ab4faeb38d"
|
||||
version = "v5.3.1"
|
||||
revision = "d5b613cb1bbdaa856fa126e7102d94783b9e80b6"
|
||||
version = "v5.4.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "mattermost"
|
||||
|
@ -145,37 +121,6 @@
|
|||
revision = "362ff1e71044349d56d37d8b75cd317bff8369b9"
|
||||
source = "https://github.com/mattermost/viper"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:bff482b22ebed387378546ba6a7850fdef87fd47f8ee58a7c62124a8e889a56b"
|
||||
name = "github.com/mattn/go-runewidth"
|
||||
packages = ["."]
|
||||
pruneopts = "NUT"
|
||||
revision = "ce7b0b5c7b45a81508558cd1dba6bb1e4ddb51bb"
|
||||
version = "v0.0.3"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:1f0c40d355bfdaad03b57ae34fcbde4d4add97c916f34c69854984dd745e09c6"
|
||||
name = "github.com/minio/minio-go"
|
||||
packages = [
|
||||
".",
|
||||
"pkg/credentials",
|
||||
"pkg/encrypt",
|
||||
"pkg/s3signer",
|
||||
"pkg/s3utils",
|
||||
"pkg/set",
|
||||
]
|
||||
pruneopts = "NUT"
|
||||
revision = "76305dad725fda18a9abcfc6cfc5797f251ea271"
|
||||
version = "v6.0.8"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:a4df73029d2c42fabcb6b41e327d2f87e685284ec03edf76921c267d9cfc9c23"
|
||||
name = "github.com/mitchellh/go-homedir"
|
||||
packages = ["."]
|
||||
pruneopts = "NUT"
|
||||
revision = "ae18d6b8b3205b561c79e8e5f69bff09736185f4"
|
||||
version = "v1.0.0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:18b773b92ac82a451c1276bd2776c1e55ce057ee202691ab33c8d6690efcc048"
|
||||
name = "github.com/mitchellh/go-testing-interface"
|
||||
|
@ -213,14 +158,6 @@
|
|||
revision = "4dadeb3030eda0273a12382bb2348ffc7c9d1a39"
|
||||
version = "v1.0.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:e6baebf0bd20950e285254902a8f2241b4870528fb63fdc10460c67b1f31b1a3"
|
||||
name = "github.com/olekukonko/tablewriter"
|
||||
packages = ["."]
|
||||
pruneopts = "NUT"
|
||||
revision = "be2c049b30ccd4d3fd795d6bf7dce74e42eeedaa"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:93b1d84c5fa6d1ea52f4114c37714cddd84d5b78f151b62bb101128dd51399bf"
|
||||
name = "github.com/pborman/uuid"
|
||||
|
@ -246,12 +183,12 @@
|
|||
version = "v0.8.0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:ecf78eacf406c42f07f66d6b79fda24d2b92dc711bfd0760d0c931678f9621fe"
|
||||
name = "github.com/sirupsen/logrus"
|
||||
packages = ["."]
|
||||
digest = "1:0028cb19b2e4c3112225cd871870f2d9cf49b9b4276531f03438a88e94be86fe"
|
||||
name = "github.com/pmezard/go-difflib"
|
||||
packages = ["difflib"]
|
||||
pruneopts = "NUT"
|
||||
revision = "ad15b42461921f1fb3529b058c6786c6a45d5162"
|
||||
version = "v1.1.1"
|
||||
revision = "792786c7400a136282c1664665ae0a8db921c6c2"
|
||||
version = "v1.0.0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:330e9062b308ac597e28485699c02223bd052437a6eed32a173c9227dcb9d95a"
|
||||
|
@ -289,12 +226,12 @@
|
|||
version = "v1.0.3"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:b0bd1fe27879214f4175ca8efdd73e672de8c8c662d705cdd63dcca7cd9c8f14"
|
||||
name = "github.com/ssor/bom"
|
||||
packages = ["."]
|
||||
digest = "1:bacb8b590716ab7c33f2277240972c9582d389593ee8d66fc10074e0508b8126"
|
||||
name = "github.com/stretchr/testify"
|
||||
packages = ["assert"]
|
||||
pruneopts = "NUT"
|
||||
revision = "6386211fdfcf24c0bfbdaceafd02849ed9a8a509"
|
||||
revision = "f35b8ab0b5a2cef36673838d662e249dd9c94686"
|
||||
version = "v1.2.2"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:22f696cee54865fb8e9ff91df7b633f6b8f22037a8015253c6b6a71ca82219c7"
|
||||
|
@ -329,26 +266,21 @@
|
|||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:d652c5a89f671eb69b2697f659e83a07a5305958ba9466210f88c62f8fe3c729"
|
||||
digest = "1:1ecf2a49df33be51e757d0033d5d51d5f784f35f68e5a38f797b2d3f03357d71"
|
||||
name = "golang.org/x/crypto"
|
||||
packages = [
|
||||
"argon2",
|
||||
"bcrypt",
|
||||
"blake2b",
|
||||
"blowfish",
|
||||
"ssh/terminal",
|
||||
]
|
||||
pruneopts = "NUT"
|
||||
revision = "7c1a557ab941a71c619514f229f0b27ccb0c27cf"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:43144a8b3203f89adbed21f991f29fb5c9fc173b1e8e1c27fc1888f6a25b9618"
|
||||
digest = "1:d39e451e542c7c064d7e29050eb50993a7484d4a3b538387c0f2ac32b5b9cdd8"
|
||||
name = "golang.org/x/net"
|
||||
packages = [
|
||||
"context",
|
||||
"html",
|
||||
"html/atom",
|
||||
"http/httpguts",
|
||||
"http2",
|
||||
"http2/hpack",
|
||||
|
@ -361,13 +293,9 @@
|
|||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:1b43e20bd17b39ab446107f91fadc62e5abd7b4210d6331d10571621706f5cdc"
|
||||
digest = "1:a9bc64e1206f3d5ce2ac71e397ddfe81065ac706929d34fcb3f0a48e74cd6e3b"
|
||||
name = "golang.org/x/sys"
|
||||
packages = [
|
||||
"cpu",
|
||||
"unix",
|
||||
"windows",
|
||||
]
|
||||
packages = ["unix"]
|
||||
pruneopts = "NUT"
|
||||
revision = "4497e2df6f9e69048a54498c7affbbec3294ad47"
|
||||
|
||||
|
@ -439,22 +367,6 @@
|
|||
revision = "8dea3dc473e90c8179e519d91302d0597c0ca1d1"
|
||||
version = "v1.15.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "v3"
|
||||
digest = "1:1244a9b3856f70d5ffb74bbfd780fc9d47f93f2049fa265c6fb602878f507bf8"
|
||||
name = "gopkg.in/alexcesaro/quotedprintable.v3"
|
||||
packages = ["."]
|
||||
pruneopts = "NUT"
|
||||
revision = "2caba252f4dc53eaf6b553000885530023f54623"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:d852dd703c644c976246382fe1539e8585cc20d642d3e68d3dff8de952237497"
|
||||
name = "gopkg.in/gomail.v2"
|
||||
packages = ["."]
|
||||
pruneopts = "NUT"
|
||||
revision = "41f3572897373c5538c50a2402db15db079fa4fd"
|
||||
version = "2.0.0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:80c34337e8a734e190f2d1b716cae774cca74db98315166f92074434e9af0227"
|
||||
name = "gopkg.in/natefinch/lumberjack.v2"
|
||||
|
@ -477,6 +389,7 @@
|
|||
input-imports = [
|
||||
"github.com/mattermost/mattermost-server/plugin",
|
||||
"github.com/pkg/errors",
|
||||
"github.com/stretchr/testify/assert",
|
||||
]
|
||||
solver-name = "gps-cdcl"
|
||||
solver-version = 1
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
[[constraint]]
|
||||
name = "github.com/mattermost/mattermost-server"
|
||||
version = "~5.3.0"
|
||||
version = "~5.4.0"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/stretchr/testify"
|
||||
|
|
Reference in a new issue