MM-31063: Change constants to use CamelCase (#16608)
* MM-31063: Change constants to use CamelCase * store package * change allcaps to camel case (#16615) * New tools.mod Co-authored-by: Ibrahim Serdar Acikgoz <serdaracikgoz86@gmail.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
8b6ac5f5d2
Коммит
c1dd23a3c8
@@ -11,7 +11,7 @@ import (
|
||||
"github.com/mattermost/mattermost-server/v5/model"
|
||||
)
|
||||
|
||||
const CHANNEL_ARG_SEPARATOR = ":"
|
||||
const ChannelArgSeparator = ":"
|
||||
|
||||
func getChannelsFromChannelArgs(a *app.App, channelArgs []string) []*model.Channel {
|
||||
channels := make([]*model.Channel, 0, len(channelArgs))
|
||||
@@ -23,7 +23,7 @@ func getChannelsFromChannelArgs(a *app.App, channelArgs []string) []*model.Chann
|
||||
}
|
||||
|
||||
func parseChannelArg(channelArg string) (string, string) {
|
||||
result := strings.SplitN(channelArg, CHANNEL_ARG_SEPARATOR, 2)
|
||||
result := strings.SplitN(channelArg, ChannelArgSeparator, 2)
|
||||
if len(result) == 1 {
|
||||
return "", channelArg
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
"github.com/mattermost/mattermost-server/v5/model"
|
||||
)
|
||||
|
||||
const COMMAND_ARGS_SEPARATOR = ":"
|
||||
const CommandArgsSeparator = ":"
|
||||
|
||||
func getCommandsFromCommandArgs(a *app.App, commandArgs []string) []*model.Command {
|
||||
commands := make([]*model.Command, 0, len(commandArgs))
|
||||
@@ -25,7 +25,7 @@ func getCommandsFromCommandArgs(a *app.App, commandArgs []string) []*model.Comma
|
||||
}
|
||||
|
||||
func parseCommandArg(commandArg string) (string, string) {
|
||||
result := strings.SplitN(commandArg, COMMAND_ARGS_SEPARATOR, 2)
|
||||
result := strings.SplitN(commandArg, CommandArgsSeparator, 2)
|
||||
|
||||
if len(result) == 1 {
|
||||
return "", commandArg
|
||||
|
||||
@@ -24,8 +24,8 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
DEACTIVATED_USER = "deactivated"
|
||||
GUEST_USER = "guest"
|
||||
DeactivatedUser = "deactivated"
|
||||
GuestUser = "guest"
|
||||
)
|
||||
|
||||
var SampleDataCmd = &cobra.Command{
|
||||
@@ -296,12 +296,12 @@ func sampleDataCmdF(command *cobra.Command, args []string) error {
|
||||
allUsers = append(allUsers, *userLine.User.Username)
|
||||
}
|
||||
for i := 0; i < guests; i++ {
|
||||
userLine := createUser(i, teamMemberships, channelMemberships, teamsAndChannels, profileImages, GUEST_USER)
|
||||
userLine := createUser(i, teamMemberships, channelMemberships, teamsAndChannels, profileImages, GuestUser)
|
||||
encoder.Encode(userLine)
|
||||
allUsers = append(allUsers, *userLine.User.Username)
|
||||
}
|
||||
for i := 0; i < deactivatedUsers; i++ {
|
||||
userLine := createUser(i, teamMemberships, channelMemberships, teamsAndChannels, profileImages, DEACTIVATED_USER)
|
||||
userLine := createUser(i, teamMemberships, channelMemberships, teamsAndChannels, profileImages, DeactivatedUser)
|
||||
encoder.Encode(userLine)
|
||||
allUsers = append(allUsers, *userLine.User.Username)
|
||||
}
|
||||
@@ -401,7 +401,7 @@ func createUser(idx int, teamMemberships int, channelMemberships int, teamsAndCh
|
||||
var email string
|
||||
|
||||
switch userType {
|
||||
case GUEST_USER:
|
||||
case GuestUser:
|
||||
password = fmt.Sprintf("SampleGu@st-%d", idx)
|
||||
email = fmt.Sprintf("guest-%d@sample.mattermost.com", idx)
|
||||
roles = "system_guest"
|
||||
@@ -410,7 +410,7 @@ func createUser(idx int, teamMemberships int, channelMemberships int, teamsAndCh
|
||||
password = "SampleGu@st1"
|
||||
email = "guest@sample.mattermost.com"
|
||||
}
|
||||
case DEACTIVATED_USER:
|
||||
case DeactivatedUser:
|
||||
password = fmt.Sprintf("SampleDe@ctivated-%d", idx)
|
||||
email = fmt.Sprintf("deactivated-%d@sample.mattermost.com", idx)
|
||||
default:
|
||||
@@ -492,12 +492,12 @@ func createUser(idx int, teamMemberships int, channelMemberships int, teamsAndCh
|
||||
team := possibleTeams[position]
|
||||
possibleTeams = append(possibleTeams[:position], possibleTeams[position+1:]...)
|
||||
if teamChannels, err := teamsAndChannels[team]; err {
|
||||
teams = append(teams, createTeamMembership(channelMemberships, teamChannels, &team, userType == GUEST_USER))
|
||||
teams = append(teams, createTeamMembership(channelMemberships, teamChannels, &team, userType == GuestUser))
|
||||
}
|
||||
}
|
||||
|
||||
var deleteAt int64
|
||||
if userType == DEACTIVATED_USER {
|
||||
if userType == DeactivatedUser {
|
||||
deleteAt = model.GetMillis()
|
||||
}
|
||||
|
||||
|
||||
@@ -38,8 +38,8 @@ func SetupServerTest(t testing.TB) *ServerTestHelper {
|
||||
// Let jobs poll for termination every 0.2s (instead of every 15s by default)
|
||||
// Otherwise we would have to wait the whole polling duration before the test
|
||||
// terminates.
|
||||
originalInterval := jobs.DEFAULT_WATCHER_POLLING_INTERVAL
|
||||
jobs.DEFAULT_WATCHER_POLLING_INTERVAL = 200
|
||||
originalInterval := jobs.DefaultWatcherPollingInterval
|
||||
jobs.DefaultWatcherPollingInterval = 200
|
||||
|
||||
th := &ServerTestHelper{
|
||||
disableConfigWatch: true,
|
||||
@@ -50,7 +50,7 @@ func SetupServerTest(t testing.TB) *ServerTestHelper {
|
||||
}
|
||||
|
||||
func (th *ServerTestHelper) TearDownServerTest() {
|
||||
jobs.DEFAULT_WATCHER_POLLING_INTERVAL = th.originalInterval
|
||||
jobs.DefaultWatcherPollingInterval = th.originalInterval
|
||||
}
|
||||
|
||||
func TestRunServerSuccess(t *testing.T) {
|
||||
|
||||
@@ -17,7 +17,7 @@ import (
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
const CUSTOM_DEFAULTS_ENV_VAR = "MM_CUSTOM_DEFAULTS_PATH"
|
||||
const CustomDefaultsEnvVar = "MM_CUSTOM_DEFAULTS_PATH"
|
||||
|
||||
// prettyPrintStruct will return a prettyPrint version of a given struct
|
||||
func prettyPrintStruct(t interface{}) string {
|
||||
@@ -123,7 +123,7 @@ func getConfigDSN(command *cobra.Command, env map[string]string) string {
|
||||
}
|
||||
|
||||
func loadCustomDefaults() (*model.Config, error) {
|
||||
customDefaultsPath := os.Getenv(CUSTOM_DEFAULTS_ENV_VAR)
|
||||
customDefaultsPath := os.Getenv(CustomDefaultsEnvVar)
|
||||
if customDefaultsPath == "" {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user