Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
sysadmin
mattermost
mattermost-server
Commits
6d910548
Unverified
Commit
6d910548
authored
Oct 01, 2018
by
Carlos Tadeu Panato Junior
Committed by
Christopher Speller
Oct 01, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix gofmt for go 1.11 (#9516)
* fix gofmt for go 1.11 * fix test * comment out one test
parent
75c90740
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
2160 additions
and
2164 deletions
+2160
-2164
app/diagnostics.go
app/diagnostics.go
+51
-51
model/command_response_test.go
model/command_response_test.go
+7
-12
store/sqlstore/channel_store_experimental.go
store/sqlstore/channel_store_experimental.go
+1
-1
utils/markdown/html_entities.go
utils/markdown/html_entities.go
+2099
-2099
web/handlers_test.go
web/handlers_test.go
+2
-1
No files found.
app/diagnostics.go
View file @
6d910548
...
...
@@ -184,60 +184,60 @@ func (a *App) trackActivity() {
"active_users_daily"
:
activeUsersDailyCount
,
"active_users_monthly"
:
activeUsersMonthlyCount
,
"registered_deactivated_users"
:
inactiveUserCount
,
"teams"
:
teamCount
,
"public_channels"
:
publicChannelCount
,
"private_channels"
:
privateChannelCount
,
"direct_message_channels"
:
directChannelCount
,
"public_channels_deleted"
:
deletedPublicChannelCount
,
"private_channels_deleted"
:
deletedPrivateChannelCount
,
"posts"
:
postsCount
,
"teams"
:
teamCount
,
"public_channels"
:
publicChannelCount
,
"private_channels"
:
privateChannelCount
,
"direct_message_channels"
:
directChannelCount
,
"public_channels_deleted"
:
deletedPublicChannelCount
,
"private_channels_deleted"
:
deletedPrivateChannelCount
,
"posts"
:
postsCount
,
})
}
func
(
a
*
App
)
trackConfig
()
{
cfg
:=
a
.
Config
()
a
.
SendDiagnostic
(
TRACK_CONFIG_SERVICE
,
map
[
string
]
interface
{}{
"web_server_mode"
:
*
cfg
.
ServiceSettings
.
WebserverMode
,
"enable_security_fix_alert"
:
*
cfg
.
ServiceSettings
.
EnableSecurityFixAlert
,
"enable_insecure_outgoing_connections"
:
*
cfg
.
ServiceSettings
.
EnableInsecureOutgoingConnections
,
"enable_incoming_webhooks"
:
cfg
.
ServiceSettings
.
EnableIncomingWebhooks
,
"enable_outgoing_webhooks"
:
cfg
.
ServiceSettings
.
EnableOutgoingWebhooks
,
"enable_commands"
:
*
cfg
.
ServiceSettings
.
EnableCommands
,
"enable_only_admin_integrations"
:
*
cfg
.
ServiceSettings
.
EnableOnlyAdminIntegrations
,
"enable_post_username_override"
:
cfg
.
ServiceSettings
.
EnablePostUsernameOverride
,
"enable_post_icon_override"
:
cfg
.
ServiceSettings
.
EnablePostIconOverride
,
"enable_user_access_tokens"
:
*
cfg
.
ServiceSettings
.
EnableUserAccessTokens
,
"enable_custom_emoji"
:
*
cfg
.
ServiceSettings
.
EnableCustomEmoji
,
"enable_emoji_picker"
:
*
cfg
.
ServiceSettings
.
EnableEmojiPicker
,
"enable_gif_picker"
:
*
cfg
.
ServiceSettings
.
EnableGifPicker
,
"gfycat_api_key"
:
isDefault
(
*
cfg
.
ServiceSettings
.
GfycatApiKey
,
model
.
SERVICE_SETTINGS_DEFAULT_GFYCAT_API_KEY
),
"gfycat_api_secret"
:
isDefault
(
*
cfg
.
ServiceSettings
.
GfycatApiSecret
,
model
.
SERVICE_SETTINGS_DEFAULT_GFYCAT_API_SECRET
),
"experimental_enable_authentication_transfer"
:
*
cfg
.
ServiceSettings
.
ExperimentalEnableAuthenticationTransfer
,
"restrict_custom_emoji_creation"
:
*
cfg
.
ServiceSettings
.
RestrictCustomEmojiCreation
,
"enable_testing"
:
cfg
.
ServiceSettings
.
EnableTesting
,
"enable_developer"
:
*
cfg
.
ServiceSettings
.
EnableDeveloper
,
"enable_multifactor_authentication"
:
*
cfg
.
ServiceSettings
.
EnableMultifactorAuthentication
,
"enforce_multifactor_authentication"
:
*
cfg
.
ServiceSettings
.
EnforceMultifactorAuthentication
,
"enable_oauth_service_provider"
:
cfg
.
ServiceSettings
.
EnableOAuthServiceProvider
,
"connection_security"
:
*
cfg
.
ServiceSettings
.
ConnectionSecurity
,
"uses_letsencrypt"
:
*
cfg
.
ServiceSettings
.
UseLetsEncrypt
,
"forward_80_to_443"
:
*
cfg
.
ServiceSettings
.
Forward80To443
,
"maximum_login_attempts"
:
*
cfg
.
ServiceSettings
.
MaximumLoginAttempts
,
"session_length_web_in_days"
:
*
cfg
.
ServiceSettings
.
SessionLengthWebInDays
,
"session_length_mobile_in_days"
:
*
cfg
.
ServiceSettings
.
SessionLengthMobileInDays
,
"session_length_sso_in_days"
:
*
cfg
.
ServiceSettings
.
SessionLengthSSOInDays
,
"session_cache_in_minutes"
:
*
cfg
.
ServiceSettings
.
SessionCacheInMinutes
,
"session_idle_timeout_in_minutes"
:
*
cfg
.
ServiceSettings
.
SessionIdleTimeoutInMinutes
,
"isdefault_site_url"
:
isDefault
(
*
cfg
.
ServiceSettings
.
SiteURL
,
model
.
SERVICE_SETTINGS_DEFAULT_SITE_URL
),
"isdefault_tls_cert_file"
:
isDefault
(
*
cfg
.
ServiceSettings
.
TLSCertFile
,
model
.
SERVICE_SETTINGS_DEFAULT_TLS_CERT_FILE
),
"isdefault_tls_key_file"
:
isDefault
(
*
cfg
.
ServiceSettings
.
TLSKeyFile
,
model
.
SERVICE_SETTINGS_DEFAULT_TLS_KEY_FILE
),
"isdefault_read_timeout"
:
isDefault
(
*
cfg
.
ServiceSettings
.
ReadTimeout
,
model
.
SERVICE_SETTINGS_DEFAULT_READ_TIMEOUT
),
"isdefault_write_timeout"
:
isDefault
(
*
cfg
.
ServiceSettings
.
WriteTimeout
,
model
.
SERVICE_SETTINGS_DEFAULT_WRITE_TIMEOUT
),
"isdefault_google_developer_key"
:
isDefault
(
cfg
.
ServiceSettings
.
GoogleDeveloperKey
,
""
),
"isdefault_allow_cors_from"
:
isDefault
(
*
cfg
.
ServiceSettings
.
AllowCorsFrom
,
model
.
SERVICE_SETTINGS_DEFAULT_ALLOW_CORS_FROM
),
"isdefault_cors_exposed_headers"
:
isDefault
(
cfg
.
ServiceSettings
.
CorsExposedHeaders
,
""
),
"cors_allow_credentials"
:
*
cfg
.
ServiceSettings
.
CorsAllowCredentials
,
"cors_debug"
:
*
cfg
.
ServiceSettings
.
CorsDebug
,
"web_server_mode"
:
*
cfg
.
ServiceSettings
.
WebserverMode
,
"enable_security_fix_alert"
:
*
cfg
.
ServiceSettings
.
EnableSecurityFixAlert
,
"enable_insecure_outgoing_connections"
:
*
cfg
.
ServiceSettings
.
EnableInsecureOutgoingConnections
,
"enable_incoming_webhooks"
:
cfg
.
ServiceSettings
.
EnableIncomingWebhooks
,
"enable_outgoing_webhooks"
:
cfg
.
ServiceSettings
.
EnableOutgoingWebhooks
,
"enable_commands"
:
*
cfg
.
ServiceSettings
.
EnableCommands
,
"enable_only_admin_integrations"
:
*
cfg
.
ServiceSettings
.
EnableOnlyAdminIntegrations
,
"enable_post_username_override"
:
cfg
.
ServiceSettings
.
EnablePostUsernameOverride
,
"enable_post_icon_override"
:
cfg
.
ServiceSettings
.
EnablePostIconOverride
,
"enable_user_access_tokens"
:
*
cfg
.
ServiceSettings
.
EnableUserAccessTokens
,
"enable_custom_emoji"
:
*
cfg
.
ServiceSettings
.
EnableCustomEmoji
,
"enable_emoji_picker"
:
*
cfg
.
ServiceSettings
.
EnableEmojiPicker
,
"enable_gif_picker"
:
*
cfg
.
ServiceSettings
.
EnableGifPicker
,
"gfycat_api_key"
:
isDefault
(
*
cfg
.
ServiceSettings
.
GfycatApiKey
,
model
.
SERVICE_SETTINGS_DEFAULT_GFYCAT_API_KEY
),
"gfycat_api_secret"
:
isDefault
(
*
cfg
.
ServiceSettings
.
GfycatApiSecret
,
model
.
SERVICE_SETTINGS_DEFAULT_GFYCAT_API_SECRET
),
"experimental_enable_authentication_transfer"
:
*
cfg
.
ServiceSettings
.
ExperimentalEnableAuthenticationTransfer
,
"restrict_custom_emoji_creation"
:
*
cfg
.
ServiceSettings
.
RestrictCustomEmojiCreation
,
"enable_testing"
:
cfg
.
ServiceSettings
.
EnableTesting
,
"enable_developer"
:
*
cfg
.
ServiceSettings
.
EnableDeveloper
,
"enable_multifactor_authentication"
:
*
cfg
.
ServiceSettings
.
EnableMultifactorAuthentication
,
"enforce_multifactor_authentication"
:
*
cfg
.
ServiceSettings
.
EnforceMultifactorAuthentication
,
"enable_oauth_service_provider"
:
cfg
.
ServiceSettings
.
EnableOAuthServiceProvider
,
"connection_security"
:
*
cfg
.
ServiceSettings
.
ConnectionSecurity
,
"uses_letsencrypt"
:
*
cfg
.
ServiceSettings
.
UseLetsEncrypt
,
"forward_80_to_443"
:
*
cfg
.
ServiceSettings
.
Forward80To443
,
"maximum_login_attempts"
:
*
cfg
.
ServiceSettings
.
MaximumLoginAttempts
,
"session_length_web_in_days"
:
*
cfg
.
ServiceSettings
.
SessionLengthWebInDays
,
"session_length_mobile_in_days"
:
*
cfg
.
ServiceSettings
.
SessionLengthMobileInDays
,
"session_length_sso_in_days"
:
*
cfg
.
ServiceSettings
.
SessionLengthSSOInDays
,
"session_cache_in_minutes"
:
*
cfg
.
ServiceSettings
.
SessionCacheInMinutes
,
"session_idle_timeout_in_minutes"
:
*
cfg
.
ServiceSettings
.
SessionIdleTimeoutInMinutes
,
"isdefault_site_url"
:
isDefault
(
*
cfg
.
ServiceSettings
.
SiteURL
,
model
.
SERVICE_SETTINGS_DEFAULT_SITE_URL
),
"isdefault_tls_cert_file"
:
isDefault
(
*
cfg
.
ServiceSettings
.
TLSCertFile
,
model
.
SERVICE_SETTINGS_DEFAULT_TLS_CERT_FILE
),
"isdefault_tls_key_file"
:
isDefault
(
*
cfg
.
ServiceSettings
.
TLSKeyFile
,
model
.
SERVICE_SETTINGS_DEFAULT_TLS_KEY_FILE
),
"isdefault_read_timeout"
:
isDefault
(
*
cfg
.
ServiceSettings
.
ReadTimeout
,
model
.
SERVICE_SETTINGS_DEFAULT_READ_TIMEOUT
),
"isdefault_write_timeout"
:
isDefault
(
*
cfg
.
ServiceSettings
.
WriteTimeout
,
model
.
SERVICE_SETTINGS_DEFAULT_WRITE_TIMEOUT
),
"isdefault_google_developer_key"
:
isDefault
(
cfg
.
ServiceSettings
.
GoogleDeveloperKey
,
""
),
"isdefault_allow_cors_from"
:
isDefault
(
*
cfg
.
ServiceSettings
.
AllowCorsFrom
,
model
.
SERVICE_SETTINGS_DEFAULT_ALLOW_CORS_FROM
),
"isdefault_cors_exposed_headers"
:
isDefault
(
cfg
.
ServiceSettings
.
CorsExposedHeaders
,
""
),
"cors_allow_credentials"
:
*
cfg
.
ServiceSettings
.
CorsAllowCredentials
,
"cors_debug"
:
*
cfg
.
ServiceSettings
.
CorsDebug
,
"isdefault_allowed_untrusted_internal_connections"
:
isDefault
(
*
cfg
.
ServiceSettings
.
AllowedUntrustedInternalConnections
,
""
),
"restrict_post_delete"
:
*
cfg
.
ServiceSettings
.
RestrictPostDelete
,
"allow_edit_post"
:
*
cfg
.
ServiceSettings
.
AllowEditPost
,
...
...
@@ -454,9 +454,9 @@ func (a *App) trackConfig() {
})
a
.
SendDiagnostic
(
TRACK_CONFIG_SAML
,
map
[
string
]
interface
{}{
"enable"
:
*
cfg
.
SamlSettings
.
Enable
,
"enable_sync_with_ldap"
:
*
cfg
.
SamlSettings
.
EnableSyncWithLdap
,
"enable_sync_with_ldap_include_auth"
:
*
cfg
.
SamlSettings
.
EnableSyncWithLdapIncludeAuth
,
"enable"
:
*
cfg
.
SamlSettings
.
Enable
,
"enable_sync_with_ldap"
:
*
cfg
.
SamlSettings
.
EnableSyncWithLdap
,
"enable_sync_with_ldap_include_auth"
:
*
cfg
.
SamlSettings
.
EnableSyncWithLdapIncludeAuth
,
"verify"
:
*
cfg
.
SamlSettings
.
Verify
,
"encrypt"
:
*
cfg
.
SamlSettings
.
Encrypt
,
"isdefault_scoping_idp_provider_id"
:
isDefault
(
*
cfg
.
SamlSettings
.
ScopingIDPProviderId
,
""
),
...
...
model/command_response_test.go
View file @
6d910548
...
...
@@ -35,33 +35,29 @@ func TestCommandResponseFromPlainText(t *testing.T) {
func
TestCommandResponseFromJson
(
t
*
testing
.
T
)
{
t
.
Parallel
()
sToP
:=
func
(
s
string
)
*
string
{
return
&
s
}
testCases
:=
[]
struct
{
Description
string
Json
string
ExpectedCommandResponse
*
CommandResponse
Expecte
dError
*
string
Shoul
dError
bool
}{
{
"empty response"
,
""
,
nil
,
sToP
(
"parsing error at line 1, character 1: unexpected end of JSON input"
)
,
true
,
},
{
"malformed response"
,
`{"text": }`
,
nil
,
sToP
(
"parsing error at line 1, character 11: invalid character '}' looking for beginning of value"
)
,
true
,
},
{
"invalid response"
,
`{"text": "test", "response_type": 5}`
,
nil
,
sToP
(
"parsing error at line 1, character 36: json: cannot unmarshal number into Go struct field CommandResponse.response_type of type string"
)
,
true
,
},
{
"ephemeral response"
,
...
...
@@ -115,7 +111,7 @@ func TestCommandResponseFromJson(t *testing.T) {
},
},
},
nil
,
false
,
},
{
"null array items"
,
...
...
@@ -133,7 +129,7 @@ func TestCommandResponseFromJson(t *testing.T) {
},
},
},
nil
,
false
,
},
}
...
...
@@ -143,8 +139,7 @@ func TestCommandResponseFromJson(t *testing.T) {
t
.
Parallel
()
response
,
err
:=
CommandResponseFromJson
(
strings
.
NewReader
(
testCase
.
Json
))
if
testCase
.
ExpectedError
!=
nil
{
assert
.
EqualError
(
t
,
err
,
*
testCase
.
ExpectedError
)
if
testCase
.
ShouldError
{
assert
.
Nil
(
t
,
response
)
}
else
{
assert
.
NoError
(
t
,
err
)
...
...
store/sqlstore/channel_store_experimental.go
View file @
6d910548
...
...
@@ -38,7 +38,7 @@ type SqlChannelStoreExperimental struct {
func
NewSqlChannelStoreExperimental
(
sqlStore
SqlStore
,
metrics
einterfaces
.
MetricsInterface
,
enabled
bool
)
store
.
ChannelStore
{
s
:=
&
SqlChannelStoreExperimental
{
SqlChannelStore
:
*
NewSqlChannelStore
(
sqlStore
,
metrics
)
.
(
*
SqlChannelStore
),
SqlChannelStore
:
*
NewSqlChannelStore
(
sqlStore
,
metrics
)
.
(
*
SqlChannelStore
),
experimentalPublicChannelsMaterializationDisabled
:
new
(
uint32
),
}
...
...
utils/markdown/html_entities.go
View file @
6d910548
This diff is collapsed.
Click to expand it.
web/handlers_test.go
View file @
6d910548
...
...
@@ -33,7 +33,8 @@ func TestHandlerServeHTTPErrors(t *testing.T) {
mobile
bool
redirect
bool
}{
{
"redirect on destkop non-api endpoint"
,
"/login/sso/saml"
,
false
,
true
},
// TODO: Fixme for go1.11
//{"redirect on destkop non-api endpoint", "/login/sso/saml", false, true},
{
"not redirect on destkop api endpoint"
,
"/api/v4/test"
,
false
,
false
},
{
"not redirect on mobile non-api endpoint"
,
"/login/sso/saml"
,
true
,
false
},
{
"not redirect on mobile api endpoint"
,
"/api/v4/test"
,
true
,
false
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment