summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/mattermost
diff options
context:
space:
mode:
authorWim <wim@42.be>2022-05-02 00:10:54 +0200
committerGitHub <noreply@github.com>2022-05-02 00:10:54 +0200
commit81e6f75aa491c7bfa11780dd622587cf5fff3c8f (patch)
tree817bca1b4071842029af876ab622bfdcb0360cca /vendor/github.com/mattermost
parent888c8b9a845866730485a3a88c27027d0960d521 (diff)
downloadmatterbridge-msglm-81e6f75aa491c7bfa11780dd622587cf5fff3c8f.tar.gz
matterbridge-msglm-81e6f75aa491c7bfa11780dd622587cf5fff3c8f.tar.bz2
matterbridge-msglm-81e6f75aa491c7bfa11780dd622587cf5fff3c8f.zip
Update dependencies (#1822)
Diffstat (limited to 'vendor/github.com/mattermost')
-rw-r--r--vendor/github.com/mattermost/mattermost-server/v6/LICENSE.txt2
-rw-r--r--vendor/github.com/mattermost/mattermost-server/v6/model/channel.go8
-rw-r--r--vendor/github.com/mattermost/mattermost-server/v6/model/channel_sidebar.go3
-rw-r--r--vendor/github.com/mattermost/mattermost-server/v6/model/client4.go13
-rw-r--r--vendor/github.com/mattermost/mattermost-server/v6/model/config.go26
-rw-r--r--vendor/github.com/mattermost/mattermost-server/v6/model/feature_flags.go18
-rw-r--r--vendor/github.com/mattermost/mattermost-server/v6/model/migration.go1
-rw-r--r--vendor/github.com/mattermost/mattermost-server/v6/model/oauth.go27
-rw-r--r--vendor/github.com/mattermost/mattermost-server/v6/model/permission.go18
-rw-r--r--vendor/github.com/mattermost/mattermost-server/v6/model/push_notification.go1
-rw-r--r--vendor/github.com/mattermost/mattermost-server/v6/model/role.go2
-rw-r--r--vendor/github.com/mattermost/mattermost-server/v6/model/session.go10
-rw-r--r--vendor/github.com/mattermost/mattermost-server/v6/model/system.go7
-rw-r--r--vendor/github.com/mattermost/mattermost-server/v6/model/team.go13
-rw-r--r--vendor/github.com/mattermost/mattermost-server/v6/model/version.go2
-rw-r--r--vendor/github.com/mattermost/mattermost-server/v6/shared/filestore/filesstore.go1
-rw-r--r--vendor/github.com/mattermost/mattermost-server/v6/shared/filestore/localstore.go45
-rw-r--r--vendor/github.com/mattermost/mattermost-server/v6/shared/filestore/s3store.go13
-rw-r--r--vendor/github.com/mattermost/mattermost-server/v6/shared/mlog/levels.go2
19 files changed, 161 insertions, 51 deletions
diff --git a/vendor/github.com/mattermost/mattermost-server/v6/LICENSE.txt b/vendor/github.com/mattermost/mattermost-server/v6/LICENSE.txt
index 8382687d..8ced25a1 100644
--- a/vendor/github.com/mattermost/mattermost-server/v6/LICENSE.txt
+++ b/vendor/github.com/mattermost/mattermost-server/v6/LICENSE.txt
@@ -22,7 +22,7 @@ a “modified version” or “work based on” Mattermost as these terms are de
MATTERMOST TRADEMARK GUIDELINES
Your use of the mark Mattermost is subject to Mattermost, Inc's prior written approval and our organization’s Trademark
-Standards of Use at http://www.mattermost.org/trademark-standards-of-use/. For trademark approval or any questions
+Standards of Use at https://mattermost.com/trademark-standards-of-use/. For trademark approval or any questions
you have about using these trademarks, please email trademark@mattermost.com
------------------------------------------------------------------------------------------------------------------------------
diff --git a/vendor/github.com/mattermost/mattermost-server/v6/model/channel.go b/vendor/github.com/mattermost/mattermost-server/v6/model/channel.go
index 2f353c7c..350a9230 100644
--- a/vendor/github.com/mattermost/mattermost-server/v6/model/channel.go
+++ b/vendor/github.com/mattermost/mattermost-server/v6/model/channel.go
@@ -178,6 +178,14 @@ func (o *Channel) DeleteAt_() float64 {
return float64(o.DeleteAt)
}
+func (o *Channel) LastPostAt_() float64 {
+ return float64(o.LastPostAt)
+}
+
+func (o *Channel) TotalMsgCount_() float64 {
+ return float64(o.TotalMsgCount)
+}
+
func (o *Channel) DeepCopy() *Channel {
copy := *o
if copy.SchemeId != nil {
diff --git a/vendor/github.com/mattermost/mattermost-server/v6/model/channel_sidebar.go b/vendor/github.com/mattermost/mattermost-server/v6/model/channel_sidebar.go
index e434e174..d5d21112 100644
--- a/vendor/github.com/mattermost/mattermost-server/v6/model/channel_sidebar.go
+++ b/vendor/github.com/mattermost/mattermost-server/v6/model/channel_sidebar.go
@@ -37,12 +37,11 @@ const (
)
// SidebarCategory represents the corresponding DB table
-// SortOrder is never returned to the user and only used for queries
type SidebarCategory struct {
Id string `json:"id"`
UserId string `json:"user_id"`
TeamId string `json:"team_id"`
- SortOrder int64 `json:"-"`
+ SortOrder int64 `json:"sort_order"`
Sorting SidebarCategorySorting `json:"sorting"`
Type SidebarCategoryType `json:"type"`
DisplayName string `json:"display_name"`
diff --git a/vendor/github.com/mattermost/mattermost-server/v6/model/client4.go b/vendor/github.com/mattermost/mattermost-server/v6/model/client4.go
index beabda82..000c0b41 100644
--- a/vendor/github.com/mattermost/mattermost-server/v6/model/client4.go
+++ b/vendor/github.com/mattermost/mattermost-server/v6/model/client4.go
@@ -7931,3 +7931,16 @@ func (c *Client4) GetUsersWithInvalidEmails(page, perPage int) ([]*User, *Respon
}
return list, BuildResponse(r), nil
}
+
+func (c *Client4) GetAppliedSchemaMigrations() ([]AppliedMigration, *Response, error) {
+ r, err := c.DoAPIGet(c.systemRoute()+"/schema/version", "")
+ if err != nil {
+ return nil, BuildResponse(r), err
+ }
+ defer closeBody(r)
+ var list []AppliedMigration
+ if jsonErr := json.NewDecoder(r.Body).Decode(&list); jsonErr != nil {
+ return nil, nil, NewAppError("GetUsers", "api.unmarshal_error", nil, jsonErr.Error(), http.StatusInternalServerError)
+ }
+ return list, BuildResponse(r), nil
+}
diff --git a/vendor/github.com/mattermost/mattermost-server/v6/model/config.go b/vendor/github.com/mattermost/mattermost-server/v6/model/config.go
index 04dfa4f5..3920bc1e 100644
--- a/vendor/github.com/mattermost/mattermost-server/v6/model/config.go
+++ b/vendor/github.com/mattermost/mattermost-server/v6/model/config.go
@@ -93,6 +93,9 @@ const (
EmailNotificationContentsFull = "full"
EmailNotificationContentsGeneric = "generic"
+ EmailSMTPDefaultServer = "localhost"
+ EmailSMTPDefaultPort = "10025"
+
SitenameMaxLength = 30
ServiceSettingsDefaultSiteURL = "http://localhost:8065"
@@ -128,9 +131,9 @@ const (
SupportSettingsDefaultTermsOfServiceLink = "https://mattermost.com/terms-of-use/"
SupportSettingsDefaultPrivacyPolicyLink = "https://mattermost.com/privacy-policy/"
- SupportSettingsDefaultAboutLink = "https://about.mattermost.com/default-about/"
- SupportSettingsDefaultHelpLink = "https://about.mattermost.com/default-help/"
- SupportSettingsDefaultReportAProblemLink = "https://about.mattermost.com/default-report-a-problem/"
+ SupportSettingsDefaultAboutLink = "https://docs.mattermost.com/about/product.html/"
+ SupportSettingsDefaultHelpLink = "https://mattermost.com/default-help/"
+ SupportSettingsDefaultReportAProblemLink = "https://mattermost.com/default-report-a-problem/"
SupportSettingsDefaultSupportEmail = ""
SupportSettingsDefaultReAcceptancePeriod = 365
@@ -167,8 +170,8 @@ const (
SamlSettingsDefaultCanonicalAlgorithm = SamlSettingsCanonicalAlgorithmC14n
NativeappSettingsDefaultAppDownloadLink = "https://mattermost.com/download/#mattermostApps"
- NativeappSettingsDefaultAndroidAppDownloadLink = "https://about.mattermost.com/mattermost-android-app/"
- NativeappSettingsDefaultIosAppDownloadLink = "https://about.mattermost.com/mattermost-ios-app/"
+ NativeappSettingsDefaultAndroidAppDownloadLink = "https://mattermost.com/mattermost-android-app/"
+ NativeappSettingsDefaultIosAppDownloadLink = "https://mattermost.com/mattermost-ios-app/"
ExperimentalSettingsDefaultLinkMetadataTimeoutMilliseconds = 5000
@@ -778,7 +781,7 @@ func (s *ServiceSettings) SetDefaults(isUpdate bool) {
}
if s.ThreadAutoFollow == nil {
- s.ThreadAutoFollow = NewBool(false)
+ s.ThreadAutoFollow = NewBool(true)
}
if s.CollapsedThreads == nil {
@@ -1598,11 +1601,11 @@ func (s *EmailSettings) SetDefaults(isUpdate bool) {
}
if s.SMTPServer == nil || *s.SMTPServer == "" {
- s.SMTPServer = NewString("localhost")
+ s.SMTPServer = NewString(EmailSMTPDefaultServer)
}
if s.SMTPPort == nil || *s.SMTPPort == "" {
- s.SMTPPort = NewString("10025")
+ s.SMTPPort = NewString(EmailSMTPDefaultPort)
}
if s.SMTPServerTimeout == nil || *s.SMTPServerTimeout == 0 {
@@ -1739,7 +1742,7 @@ type SupportSettings struct {
AboutLink *string `access:"site_customization,write_restrictable,cloud_restrictable"`
HelpLink *string `access:"site_customization,write_restrictable,cloud_restrictable"`
ReportAProblemLink *string `access:"site_customization,write_restrictable,cloud_restrictable"`
- SupportEmail *string `access:"site_customization"`
+ SupportEmail *string `access:"site_notifications"`
CustomTermsOfServiceEnabled *bool `access:"compliance_custom_terms_of_service"`
CustomTermsOfServiceReAcceptancePeriod *int `access:"compliance_custom_terms_of_service"`
EnableAskCommunityLink *bool `access:"site_customization"`
@@ -2748,6 +2751,11 @@ func (s *PluginSettings) SetDefaults(ls LogSettings) {
s.PluginStates["focalboard"] = &PluginState{Enable: true}
}
+ if s.PluginStates["com.mattermost.apps"] == nil {
+ // Enable the Apps plugin by default
+ s.PluginStates["com.mattermost.apps"] = &PluginState{Enable: true}
+ }
+
if s.EnableMarketplace == nil {
s.EnableMarketplace = NewBool(PluginSettingsDefaultEnableMarketplace)
}
diff --git a/vendor/github.com/mattermost/mattermost-server/v6/model/feature_flags.go b/vendor/github.com/mattermost/mattermost-server/v6/model/feature_flags.go
index a2fe45bd..d89dd7c3 100644
--- a/vendor/github.com/mattermost/mattermost-server/v6/model/feature_flags.go
+++ b/vendor/github.com/mattermost/mattermost-server/v6/model/feature_flags.go
@@ -38,9 +38,6 @@ type FeatureFlags struct {
PermalinkPreviews bool
- // Enable the Global Header
- GlobalHeader bool
-
// Determine whether when a user gets created, they'll have noisy notifications e.g. Send desktop notifications for all activity
NewAccountNoisy bool
@@ -56,17 +53,11 @@ type FeatureFlags struct {
// Enable Create First Channel
GuidedChannelCreation bool
- // Determine after which duration in hours to send a second invitation to someone that didn't join after the initial invite, possible values = ("48", "72")
- ResendInviteEmailInterval string
-
// A/B test for whether radio buttons or toggle button is more effective in in-screen invite to team modal ("none", "toggle")
InviteToTeam string
CustomGroups bool
- // Enable inline post editing
- InlinePostEditing bool
-
// Enable DataRetention for Boards
BoardsDataRetention bool
@@ -77,9 +68,6 @@ type FeatureFlags struct {
// Enable special onboarding flow for first admin
UseCaseOnboarding bool
- // Enable Workspace optimization dashboard
- WorkspaceOptimizationDashboard bool
-
// Enable GraphQL feature
GraphQL bool
}
@@ -90,26 +78,22 @@ func (f *FeatureFlags) SetDefaults() {
f.CloudDelinquentEmailJobsEnabled = false
f.CollapsedThreads = true
f.EnableRemoteClusterService = false
- f.AppsEnabled = false
+ f.AppsEnabled = true
f.AppBarEnabled = false
f.PluginApps = ""
f.PluginFocalboard = ""
f.PermalinkPreviews = true
- f.GlobalHeader = true
f.NewAccountNoisy = false
f.CallsMobile = false
f.BoardsFeatureFlags = ""
f.AddMembersToChannel = "top"
f.GuidedChannelCreation = false
- f.ResendInviteEmailInterval = ""
f.InviteToTeam = "none"
f.CustomGroups = true
- f.InlinePostEditing = false
f.BoardsDataRetention = false
f.NormalizeLdapDNs = false
f.EnableInactivityCheckJob = true
f.UseCaseOnboarding = true
- f.WorkspaceOptimizationDashboard = true
f.GraphQL = false
}
func (f *FeatureFlags) Plugins() map[string]string {
diff --git a/vendor/github.com/mattermost/mattermost-server/v6/model/migration.go b/vendor/github.com/mattermost/mattermost-server/v6/model/migration.go
index 16172e50..4958f80e 100644
--- a/vendor/github.com/mattermost/mattermost-server/v6/model/migration.go
+++ b/vendor/github.com/mattermost/mattermost-server/v6/model/migration.go
@@ -37,4 +37,5 @@ const (
MigrationKeyAddIntegrationsSubsectionPermissions = "integrations_subsection_permissions"
MigrationKeyAddPlaybooksPermissions = "playbooks_permissions"
MigrationKeyAddCustomUserGroupsPermissions = "custom_groups_permissions"
+ MigrationKeyAddPlayboosksManageRolesPermissions = "playbooks_manage_roles"
)
diff --git a/vendor/github.com/mattermost/mattermost-server/v6/model/oauth.go b/vendor/github.com/mattermost/mattermost-server/v6/model/oauth.go
index a3d7f95f..82dd8fb2 100644
--- a/vendor/github.com/mattermost/mattermost-server/v6/model/oauth.go
+++ b/vendor/github.com/mattermost/mattermost-server/v6/model/oauth.go
@@ -18,17 +18,18 @@ const (
)
type OAuthApp struct {
- Id string `json:"id"`
- CreatorId string `json:"creator_id"`
- CreateAt int64 `json:"create_at"`
- UpdateAt int64 `json:"update_at"`
- ClientSecret string `json:"client_secret"`
- Name string `json:"name"`
- Description string `json:"description"`
- IconURL string `json:"icon_url"`
- CallbackUrls StringArray `json:"callback_urls"`
- Homepage string `json:"homepage"`
- IsTrusted bool `json:"is_trusted"`
+ Id string `json:"id"`
+ CreatorId string `json:"creator_id"`
+ CreateAt int64 `json:"create_at"`
+ UpdateAt int64 `json:"update_at"`
+ ClientSecret string `json:"client_secret"`
+ Name string `json:"name"`
+ Description string `json:"description"`
+ IconURL string `json:"icon_url"`
+ CallbackUrls StringArray `json:"callback_urls"`
+ Homepage string `json:"homepage"`
+ IsTrusted bool `json:"is_trusted"`
+ MattermostAppID string `json:"mattermost_app_id"`
}
// IsValid validates the app and returns an error if it isn't configured
@@ -83,6 +84,10 @@ func (a *OAuthApp) IsValid() *AppError {
}
}
+ if len(a.MattermostAppID) > 32 {
+ return NewAppError("OAuthApp.IsValid", "model.oauth.is_valid.mattermost_app_id.app_error", nil, "app_id="+a.Id, http.StatusBadRequest)
+ }
+
return nil
}
diff --git a/vendor/github.com/mattermost/mattermost-server/v6/model/permission.go b/vendor/github.com/mattermost/mattermost-server/v6/model/permission.go
index e8d9d2c3..bf1f4023 100644
--- a/vendor/github.com/mattermost/mattermost-server/v6/model/permission.go
+++ b/vendor/github.com/mattermost/mattermost-server/v6/model/permission.go
@@ -337,12 +337,14 @@ var PermissionSysconsoleWriteExperimentalBleve *Permission
var PermissionPublicPlaybookCreate *Permission
var PermissionPublicPlaybookManageProperties *Permission
var PermissionPublicPlaybookManageMembers *Permission
+var PermissionPublicPlaybookManageRoles *Permission
var PermissionPublicPlaybookView *Permission
var PermissionPublicPlaybookMakePrivate *Permission
var PermissionPrivatePlaybookCreate *Permission
var PermissionPrivatePlaybookManageProperties *Permission
var PermissionPrivatePlaybookManageMembers *Permission
+var PermissionPrivatePlaybookManageRoles *Permission
var PermissionPrivatePlaybookView *Permission
var PermissionPrivatePlaybookMakePublic *Permission
@@ -1970,6 +1972,13 @@ func initializePermissions() {
PermissionScopePlaybook,
}
+ PermissionPublicPlaybookManageRoles = &Permission{
+ "playbook_public_manage_roles",
+ "",
+ "",
+ PermissionScopePlaybook,
+ }
+
PermissionPublicPlaybookView = &Permission{
"playbook_public_view",
"",
@@ -2005,6 +2014,13 @@ func initializePermissions() {
PermissionScopePlaybook,
}
+ PermissionPrivatePlaybookManageRoles = &Permission{
+ "playbook_private_manage_roles",
+ "",
+ "",
+ PermissionScopePlaybook,
+ }
+
PermissionPrivatePlaybookView = &Permission{
"playbook_private_view",
"",
@@ -2327,10 +2343,12 @@ func initializePermissions() {
PlaybookScopedPermissions := []*Permission{
PermissionPublicPlaybookManageProperties,
PermissionPublicPlaybookManageMembers,
+ PermissionPublicPlaybookManageRoles,
PermissionPublicPlaybookView,
PermissionPublicPlaybookMakePrivate,
PermissionPrivatePlaybookManageProperties,
PermissionPrivatePlaybookManageMembers,
+ PermissionPrivatePlaybookManageRoles,
PermissionPrivatePlaybookView,
PermissionPrivatePlaybookMakePublic,
PermissionRunCreate,
diff --git a/vendor/github.com/mattermost/mattermost-server/v6/model/push_notification.go b/vendor/github.com/mattermost/mattermost-server/v6/model/push_notification.go
index d46c24ec..09a645ea 100644
--- a/vendor/github.com/mattermost/mattermost-server/v6/model/push_notification.go
+++ b/vendor/github.com/mattermost/mattermost-server/v6/model/push_notification.go
@@ -17,6 +17,7 @@ const (
PushTypeClear = "clear"
PushTypeUpdateBadge = "update_badge"
PushTypeSession = "session"
+ PushTypeTest = "test"
PushMessageV2 = "v2"
PushSoundNone = "none"
diff --git a/vendor/github.com/mattermost/mattermost-server/v6/model/role.go b/vendor/github.com/mattermost/mattermost-server/v6/model/role.go
index 37edec4f..081e7b68 100644
--- a/vendor/github.com/mattermost/mattermost-server/v6/model/role.go
+++ b/vendor/github.com/mattermost/mattermost-server/v6/model/role.go
@@ -836,8 +836,10 @@ func MakeDefaultRoles() map[string]*Role {
Description: "authentication.roles.playbook_admin.description",
Permissions: []string{
PermissionPublicPlaybookManageMembers.Id,
+ PermissionPublicPlaybookManageRoles.Id,
PermissionPublicPlaybookManageProperties.Id,
PermissionPrivatePlaybookManageMembers.Id,
+ PermissionPrivatePlaybookManageRoles.Id,
PermissionPrivatePlaybookManageProperties.Id,
PermissionPublicPlaybookMakePrivate.Id,
},
diff --git a/vendor/github.com/mattermost/mattermost-server/v6/model/session.go b/vendor/github.com/mattermost/mattermost-server/v6/model/session.go
index 36955583..fcf8eea1 100644
--- a/vendor/github.com/mattermost/mattermost-server/v6/model/session.go
+++ b/vendor/github.com/mattermost/mattermost-server/v6/model/session.go
@@ -24,6 +24,8 @@ const (
SessionPropUserAccessTokenId = "user_access_token_id"
SessionPropIsBot = "is_bot"
SessionPropIsBotValue = "true"
+ SessionPropOAuthAppID = "oauth_app_id"
+ SessionPropMattermostAppID = "mattermost_app_id"
SessionTypeUserAccessToken = "UserAccessToken"
SessionTypeCloudKey = "CloudKey"
SessionTypeRemoteclusterToken = "RemoteClusterToken"
@@ -218,3 +220,11 @@ func (s *Session) GetCSRF() string {
return s.Props["csrf"]
}
+
+func (s *Session) CreateAt_() float64 {
+ return float64(s.CreateAt)
+}
+
+func (s *Session) ExpiresAt_() float64 {
+ return float64(s.ExpiresAt)
+}
diff --git a/vendor/github.com/mattermost/mattermost-server/v6/model/system.go b/vendor/github.com/mattermost/mattermost-server/v6/model/system.go
index b1b9ca19..29fef336 100644
--- a/vendor/github.com/mattermost/mattermost-server/v6/model/system.go
+++ b/vendor/github.com/mattermost/mattermost-server/v6/model/system.go
@@ -79,6 +79,8 @@ type ServerBusyState struct {
type SupportPacket struct {
ServerOS string `yaml:"server_os"`
ServerArchitecture string `yaml:"server_architecture"`
+ ServerVersion string `yaml:"server_version"`
+ BuildHash string `yaml:"build_hash,omitempty"`
DatabaseType string `yaml:"database_type"`
DatabaseVersion string `yaml:"database_version"`
LdapVendorName string `yaml:"ldap_vendor_name,omitempty"`
@@ -173,3 +175,8 @@ type WarnMetricStatus struct {
type SendWarnMetricAck struct {
ForceAck bool `json:"forceAck"`
}
+
+type AppliedMigration struct {
+ Version int `json:"version"`
+ Name string `json:"name"`
+}
diff --git a/vendor/github.com/mattermost/mattermost-server/v6/model/team.go b/vendor/github.com/mattermost/mattermost-server/v6/model/team.go
index a5aa7f94..7a21ffc7 100644
--- a/vendor/github.com/mattermost/mattermost-server/v6/model/team.go
+++ b/vendor/github.com/mattermost/mattermost-server/v6/model/team.go
@@ -251,3 +251,16 @@ func (o *Team) Patch(patch *TeamPatch) {
func (o *Team) IsGroupConstrained() bool {
return o.GroupConstrained != nil && *o.GroupConstrained
}
+
+// The following are some GraphQL methods necessary to return the
+// data in float64 type. The spec doesn't support 64 bit integers,
+// so we have to pass the data in float64. The _ at the end is
+// a hack to keep the attribute name same in GraphQL schema.
+
+func (o *Team) UpdateAt_() float64 {
+ return float64(o.UpdateAt)
+}
+
+func (o *Team) LastTeamIconUpdate_() float64 {
+ return float64(o.LastTeamIconUpdate)
+}
diff --git a/vendor/github.com/mattermost/mattermost-server/v6/model/version.go b/vendor/github.com/mattermost/mattermost-server/v6/model/version.go
index 144b0303..7400c373 100644
--- a/vendor/github.com/mattermost/mattermost-server/v6/model/version.go
+++ b/vendor/github.com/mattermost/mattermost-server/v6/model/version.go
@@ -13,6 +13,8 @@ import (
// It should be maintained in chronological order with most current
// release at the front of the list.
var versions = []string{
+ "6.6.1",
+ "6.6.0",
"6.5.0",
"6.4.0",
"6.3.0",
diff --git a/vendor/github.com/mattermost/mattermost-server/v6/shared/filestore/filesstore.go b/vendor/github.com/mattermost/mattermost-server/v6/shared/filestore/filesstore.go
index ef02895d..c17ea1f6 100644
--- a/vendor/github.com/mattermost/mattermost-server/v6/shared/filestore/filesstore.go
+++ b/vendor/github.com/mattermost/mattermost-server/v6/shared/filestore/filesstore.go
@@ -35,6 +35,7 @@ type FileBackend interface {
FileModTime(path string) (time.Time, error)
ListDirectory(path string) ([]string, error)
+ ListDirectoryRecursively(path string) ([]string, error)
RemoveDirectory(path string) error
}
diff --git a/vendor/github.com/mattermost/mattermost-server/v6/shared/filestore/localstore.go b/vendor/github.com/mattermost/mattermost-server/v6/shared/filestore/localstore.go
index 5ed882de..e2d53e49 100644
--- a/vendor/github.com/mattermost/mattermost-server/v6/shared/filestore/localstore.go
+++ b/vendor/github.com/mattermost/mattermost-server/v6/shared/filestore/localstore.go
@@ -188,19 +188,48 @@ func (b *LocalFileBackend) RemoveFile(path string) error {
return nil
}
-func (b *LocalFileBackend) ListDirectory(path string) ([]string, error) {
- var paths []string
- fileInfos, err := ioutil.ReadDir(filepath.Join(b.directory, path))
+// basePath: path to get to the file but won't be added to the end result
+// path: basePath+path current directory we are looking at
+// maxDepth: parameter to prevent infinite recursion, once this is reached we won't look any further
+func appendRecursively(basePath, path string, maxDepth int) ([]string, error) {
+ results := []string{}
+ dirEntries, err := os.ReadDir(filepath.Join(basePath, path))
if err != nil {
if os.IsNotExist(err) {
- return paths, nil
+ return results, nil
}
- return nil, errors.Wrapf(err, "unable to list the directory %s", path)
+ return results, errors.Wrapf(err, "unable to list the directory %s", path)
}
- for _, fileInfo := range fileInfos {
- paths = append(paths, filepath.Join(path, fileInfo.Name()))
+ for _, dirEntry := range dirEntries {
+ entryName := dirEntry.Name()
+ entryPath := filepath.Join(path, entryName)
+ if entryName == "." || entryName == ".." || entryPath == path {
+ continue
+ }
+ if dirEntry.IsDir() {
+ if maxDepth <= 0 {
+ mlog.Warn("Max Depth reached", mlog.String("path", entryPath))
+ results = append(results, entryPath)
+ continue // we'll ignore it if max depth is reached.
+ }
+ nestedResults, err := appendRecursively(basePath, entryPath, maxDepth-1)
+ if err != nil {
+ return results, err
+ }
+ results = append(results, nestedResults...)
+ } else {
+ results = append(results, entryPath)
+ }
}
- return paths, nil
+ return results, nil
+}
+
+func (b *LocalFileBackend) ListDirectory(path string) ([]string, error) {
+ return appendRecursively(b.directory, path, 0)
+}
+
+func (b *LocalFileBackend) ListDirectoryRecursively(path string) ([]string, error) {
+ return appendRecursively(b.directory, path, 10)
}
func (b *LocalFileBackend) RemoveDirectory(path string) error {
diff --git a/vendor/github.com/mattermost/mattermost-server/v6/shared/filestore/s3store.go b/vendor/github.com/mattermost/mattermost-server/v6/shared/filestore/s3store.go
index c45f626a..5ab6f1ce 100644
--- a/vendor/github.com/mattermost/mattermost-server/v6/shared/filestore/s3store.go
+++ b/vendor/github.com/mattermost/mattermost-server/v6/shared/filestore/s3store.go
@@ -396,7 +396,7 @@ func getPathsFromObjectInfos(in <-chan s3.ObjectInfo) <-chan s3.ObjectInfo {
return out
}
-func (b *S3FileBackend) ListDirectory(path string) ([]string, error) {
+func (b *S3FileBackend) listDirectory(path string, recursion bool) ([]string, error) {
path = filepath.Join(b.pathPrefix, path)
if !strings.HasSuffix(path, "/") && path != "" {
// s3Clnt returns only the path itself when "/" is not present
@@ -405,7 +405,8 @@ func (b *S3FileBackend) ListDirectory(path string) ([]string, error) {
}
opts := s3.ListObjectsOptions{
- Prefix: path,
+ Prefix: path,
+ Recursive: recursion,
}
var paths []string
for object := range b.client.ListObjects(context.Background(), b.bucket, opts) {
@@ -424,6 +425,14 @@ func (b *S3FileBackend) ListDirectory(path string) ([]string, error) {
return paths, nil
}
+func (b *S3FileBackend) ListDirectory(path string) ([]string, error) {
+ return b.listDirectory(path, false)
+}
+
+func (b *S3FileBackend) ListDirectoryRecursively(path string) ([]string, error) {
+ return b.listDirectory(path, true)
+}
+
func (b *S3FileBackend) RemoveDirectory(path string) error {
opts := s3.ListObjectsOptions{
Prefix: filepath.Join(b.pathPrefix, path),
diff --git a/vendor/github.com/mattermost/mattermost-server/v6/shared/mlog/levels.go b/vendor/github.com/mattermost/mattermost-server/v6/shared/mlog/levels.go
index c0b30996..1c88e816 100644
--- a/vendor/github.com/mattermost/mattermost-server/v6/shared/mlog/levels.go
+++ b/vendor/github.com/mattermost/mattermost-server/v6/shared/mlog/levels.go
@@ -14,7 +14,7 @@ var (
LvlInfo = logr.Info // ID = 4
LvlDebug = logr.Debug // ID = 5
LvlTrace = logr.Trace // ID = 6
- StdAll = []Level{LvlPanic, LvlFatal, LvlError, LvlWarn, LvlInfo, LvlDebug, LvlTrace}
+ StdAll = []Level{LvlPanic, LvlFatal, LvlError, LvlWarn, LvlInfo, LvlDebug, LvlTrace, LvlStdLog}
// non-standard "critical" level
LvlCritical = Level{ID: 7, Name: "critical"}
// used by redirected standard logger