Merge branch 'master' into advanced-permissions-phase-1
Этот коммит содержится в:
@@ -86,12 +86,7 @@ func (o *Channel) Etag() string {
|
||||
return Etag(o.Id, o.UpdateAt)
|
||||
}
|
||||
|
||||
func (o *Channel) StatsEtag() string {
|
||||
return Etag(o.Id, o.ExtraUpdateAt)
|
||||
}
|
||||
|
||||
func (o *Channel) IsValid() *AppError {
|
||||
|
||||
if len(o.Id) != 26 {
|
||||
return NewAppError("Channel.IsValid", "model.channel.is_valid.id.app_error", nil, "", http.StatusBadRequest)
|
||||
}
|
||||
|
||||
@@ -699,7 +699,7 @@ func (c *Client4) GetUsersNotInTeam(teamId string, page int, perPage int, etag s
|
||||
}
|
||||
}
|
||||
|
||||
// GetUsersInChannel returns a page of users on a team. Page counting starts at 0.
|
||||
// GetUsersInChannel returns a page of users in a channel. Page counting starts at 0.
|
||||
func (c *Client4) GetUsersInChannel(channelId string, page int, perPage int, etag string) ([]*User, *Response) {
|
||||
query := fmt.Sprintf("?in_channel=%v&page=%v&per_page=%v", channelId, page, perPage)
|
||||
if r, err := c.DoApiGet(c.GetUsersRoute()+query, etag); err != nil {
|
||||
@@ -710,7 +710,18 @@ func (c *Client4) GetUsersInChannel(channelId string, page int, perPage int, eta
|
||||
}
|
||||
}
|
||||
|
||||
// GetUsersNotInChannel returns a page of users on a team. Page counting starts at 0.
|
||||
// GetUsersInChannelStatus returns a page of users in a channel. Page counting starts at 0. Sorted by Status
|
||||
func (c *Client4) GetUsersInChannelByStatus(channelId string, page int, perPage int, etag string) ([]*User, *Response) {
|
||||
query := fmt.Sprintf("?in_channel=%v&page=%v&per_page=%v&sort=status", channelId, page, perPage)
|
||||
if r, err := c.DoApiGet(c.GetUsersRoute()+query, etag); err != nil {
|
||||
return nil, BuildErrorResponse(r, err)
|
||||
} else {
|
||||
defer closeBody(r)
|
||||
return UserListFromJson(r.Body), BuildResponse(r)
|
||||
}
|
||||
}
|
||||
|
||||
// GetUsersNotInChannel returns a page of users not in a channel. Page counting starts at 0.
|
||||
func (c *Client4) GetUsersNotInChannel(teamId, channelId string, page int, perPage int, etag string) ([]*User, *Response) {
|
||||
query := fmt.Sprintf("?in_team=%v¬_in_channel=%v&page=%v&per_page=%v", teamId, channelId, page, perPage)
|
||||
if r, err := c.DoApiGet(c.GetUsersRoute()+query, etag); err != nil {
|
||||
|
||||
@@ -6,7 +6,6 @@ package model
|
||||
import (
|
||||
"encoding/json"
|
||||
"io"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type ClusterInfo struct {
|
||||
@@ -22,11 +21,6 @@ func (me *ClusterInfo) ToJson() string {
|
||||
return string(b)
|
||||
}
|
||||
|
||||
func (me *ClusterInfo) Copy() *ClusterInfo {
|
||||
json := me.ToJson()
|
||||
return ClusterInfoFromJson(strings.NewReader(json))
|
||||
}
|
||||
|
||||
func ClusterInfoFromJson(data io.Reader) *ClusterInfo {
|
||||
var me *ClusterInfo
|
||||
json.NewDecoder(data).Decode(&me)
|
||||
|
||||
@@ -17,6 +17,7 @@ type CompliancePost struct {
|
||||
// From Channel
|
||||
ChannelName string
|
||||
ChannelDisplayName string
|
||||
ChannelType string
|
||||
|
||||
// From User
|
||||
UserUsername string
|
||||
@@ -45,6 +46,7 @@ func CompliancePostHeader() []string {
|
||||
|
||||
"ChannelName",
|
||||
"ChannelDisplayName",
|
||||
"ChannelType",
|
||||
|
||||
"UserUsername",
|
||||
"UserEmail",
|
||||
@@ -92,6 +94,7 @@ func (me *CompliancePost) Row() []string {
|
||||
|
||||
cleanComplianceStrings(me.ChannelName),
|
||||
cleanComplianceStrings(me.ChannelDisplayName),
|
||||
cleanComplianceStrings(me.ChannelType),
|
||||
|
||||
cleanComplianceStrings(me.UserUsername),
|
||||
cleanComplianceStrings(me.UserEmail),
|
||||
|
||||
@@ -35,10 +35,6 @@ const (
|
||||
SERVICE_GOOGLE = "google"
|
||||
SERVICE_OFFICE365 = "office365"
|
||||
|
||||
WEBSERVER_MODE_REGULAR = "regular"
|
||||
WEBSERVER_MODE_GZIP = "gzip"
|
||||
WEBSERVER_MODE_DISABLED = "disabled"
|
||||
|
||||
GENERIC_NO_CHANNEL_NOTIFICATION = "generic_no_channel"
|
||||
GENERIC_NOTIFICATION = "generic"
|
||||
FULL_NOTIFICATION = "full"
|
||||
@@ -99,15 +95,12 @@ const (
|
||||
|
||||
EMAIL_SETTINGS_DEFAULT_FEEDBACK_ORGANIZATION = ""
|
||||
|
||||
SUPPORT_SETTINGS_DEFAULT_TERMS_OF_SERVICE_LINK = "https://about.mattermost.com/default-terms/"
|
||||
SUPPORT_SETTINGS_DEFAULT_PRIVACY_POLICY_LINK = "https://about.mattermost.com/default-privacy-policy/"
|
||||
SUPPORT_SETTINGS_DEFAULT_ABOUT_LINK = "https://about.mattermost.com/default-about/"
|
||||
SUPPORT_SETTINGS_DEFAULT_HELP_LINK = "https://about.mattermost.com/default-help/"
|
||||
SUPPORT_SETTINGS_DEFAULT_REPORT_A_PROBLEM_LINK = "https://about.mattermost.com/default-report-a-problem/"
|
||||
SUPPORT_SETTINGS_DEFAULT_ADMINISTRATORS_GUIDE_LINK = "https://about.mattermost.com/administrators-guide/"
|
||||
SUPPORT_SETTINGS_DEFAULT_TROUBLESHOOTING_FORUM_LINK = "https://about.mattermost.com/troubleshooting-forum/"
|
||||
SUPPORT_SETTINGS_DEFAULT_COMMERCIAL_SUPPORT_LINK = "https://about.mattermost.com/commercial-support/"
|
||||
SUPPORT_SETTINGS_DEFAULT_SUPPORT_EMAIL = "feedback@mattermost.com"
|
||||
SUPPORT_SETTINGS_DEFAULT_TERMS_OF_SERVICE_LINK = "https://about.mattermost.com/default-terms/"
|
||||
SUPPORT_SETTINGS_DEFAULT_PRIVACY_POLICY_LINK = "https://about.mattermost.com/default-privacy-policy/"
|
||||
SUPPORT_SETTINGS_DEFAULT_ABOUT_LINK = "https://about.mattermost.com/default-about/"
|
||||
SUPPORT_SETTINGS_DEFAULT_HELP_LINK = "https://about.mattermost.com/default-help/"
|
||||
SUPPORT_SETTINGS_DEFAULT_REPORT_A_PROBLEM_LINK = "https://about.mattermost.com/default-report-a-problem/"
|
||||
SUPPORT_SETTINGS_DEFAULT_SUPPORT_EMAIL = "feedback@mattermost.com"
|
||||
|
||||
LDAP_SETTINGS_DEFAULT_FIRST_NAME_ATTRIBUTE = ""
|
||||
LDAP_SETTINGS_DEFAULT_LAST_NAME_ATTRIBUTE = ""
|
||||
@@ -161,6 +154,8 @@ const (
|
||||
|
||||
COMPLIANCE_EXPORT_TYPE_ACTIANCE = "actiance"
|
||||
COMPLIANCE_EXPORT_TYPE_GLOBALRELAY = "globalrelay"
|
||||
GLOBALRELAY_CUSTOMER_TYPE_A9 = "A9"
|
||||
GLOBALRELAY_CUSTOMER_TYPE_A10 = "A10"
|
||||
)
|
||||
|
||||
type ServiceSettings struct {
|
||||
@@ -1638,6 +1633,28 @@ func (s *PluginSettings) SetDefaults() {
|
||||
}
|
||||
}
|
||||
|
||||
type GlobalRelayMessageExportSettings struct {
|
||||
CustomerType *string // must be either A9 or A10, dictates SMTP server url
|
||||
SmtpUsername *string
|
||||
SmtpPassword *string
|
||||
EmailAddress *string // the address to send messages to
|
||||
}
|
||||
|
||||
func (s *GlobalRelayMessageExportSettings) SetDefaults() {
|
||||
if s.CustomerType == nil {
|
||||
s.CustomerType = NewString(GLOBALRELAY_CUSTOMER_TYPE_A9)
|
||||
}
|
||||
if s.SmtpUsername == nil {
|
||||
s.SmtpUsername = NewString("")
|
||||
}
|
||||
if s.SmtpPassword == nil {
|
||||
s.SmtpPassword = NewString("")
|
||||
}
|
||||
if s.EmailAddress == nil {
|
||||
s.EmailAddress = NewString("")
|
||||
}
|
||||
}
|
||||
|
||||
type MessageExportSettings struct {
|
||||
EnableExport *bool
|
||||
ExportFormat *string
|
||||
@@ -1646,7 +1663,7 @@ type MessageExportSettings struct {
|
||||
BatchSize *int
|
||||
|
||||
// formatter-specific settings - these are only expected to be non-nil if ExportFormat is set to the associated format
|
||||
GlobalRelayEmailAddress *string
|
||||
GlobalRelaySettings *GlobalRelayMessageExportSettings
|
||||
}
|
||||
|
||||
func (s *MessageExportSettings) SetDefaults() {
|
||||
@@ -1677,6 +1694,11 @@ func (s *MessageExportSettings) SetDefaults() {
|
||||
if s.BatchSize == nil {
|
||||
s.BatchSize = NewInt(10000)
|
||||
}
|
||||
|
||||
if s.GlobalRelaySettings == nil {
|
||||
s.GlobalRelaySettings = &GlobalRelayMessageExportSettings{}
|
||||
s.GlobalRelaySettings.SetDefaults()
|
||||
}
|
||||
}
|
||||
|
||||
type ConfigFunc func() *Config
|
||||
@@ -2210,10 +2232,18 @@ func (mes *MessageExportSettings) isValid(fs FileSettings) *AppError {
|
||||
}
|
||||
|
||||
if *mes.ExportFormat == COMPLIANCE_EXPORT_TYPE_GLOBALRELAY {
|
||||
// validating email addresses is hard - just make sure it contains an '@' sign
|
||||
// see https://stackoverflow.com/questions/201323/using-a-regular-expression-to-validate-an-email-address
|
||||
if mes.GlobalRelayEmailAddress == nil || !strings.Contains(*mes.GlobalRelayEmailAddress, "@") {
|
||||
return NewAppError("Config.IsValid", "model.config.is_valid.message_export.global_relay_email_address.app_error", nil, "", http.StatusBadRequest)
|
||||
if mes.GlobalRelaySettings == nil {
|
||||
return NewAppError("Config.IsValid", "model.config.is_valid.message_export.global_relay.config_missing.app_error", nil, "", http.StatusBadRequest)
|
||||
} else if mes.GlobalRelaySettings.CustomerType == nil || (*mes.GlobalRelaySettings.CustomerType != GLOBALRELAY_CUSTOMER_TYPE_A9 && *mes.GlobalRelaySettings.CustomerType != GLOBALRELAY_CUSTOMER_TYPE_A10) {
|
||||
return NewAppError("Config.IsValid", "model.config.is_valid.message_export.global_relay.customer_type.app_error", nil, "", http.StatusBadRequest)
|
||||
} else if mes.GlobalRelaySettings.EmailAddress == nil || !strings.Contains(*mes.GlobalRelaySettings.EmailAddress, "@") {
|
||||
// validating email addresses is hard - just make sure it contains an '@' sign
|
||||
// see https://stackoverflow.com/questions/201323/using-a-regular-expression-to-validate-an-email-address
|
||||
return NewAppError("Config.IsValid", "model.config.is_valid.message_export.global_relay.email_address.app_error", nil, "", http.StatusBadRequest)
|
||||
} else if mes.GlobalRelaySettings.SmtpUsername == nil || *mes.GlobalRelaySettings.SmtpUsername == "" {
|
||||
return NewAppError("Config.IsValid", "model.config.is_valid.message_export.global_relay.smtp_username.app_error", nil, "", http.StatusBadRequest)
|
||||
} else if mes.GlobalRelaySettings.SmtpPassword == nil || *mes.GlobalRelaySettings.SmtpPassword == "" {
|
||||
return NewAppError("Config.IsValid", "model.config.is_valid.message_export.global_relay.smtp_password.app_error", nil, "", http.StatusBadRequest)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -183,21 +183,123 @@ func TestMessageExportSettingsIsValidActiance(t *testing.T) {
|
||||
require.Nil(t, mes.isValid(*fs))
|
||||
}
|
||||
|
||||
func TestMessageExportSettingsIsValidGlobalRelay(t *testing.T) {
|
||||
func TestMessageExportSettingsIsValidGlobalRelaySettingsMissing(t *testing.T) {
|
||||
fs := &FileSettings{
|
||||
DriverName: NewString("foo"), // bypass file location check
|
||||
}
|
||||
mes := &MessageExportSettings{
|
||||
EnableExport: NewBool(true),
|
||||
ExportFormat: NewString(COMPLIANCE_EXPORT_TYPE_GLOBALRELAY),
|
||||
ExportFromTimestamp: NewInt64(0),
|
||||
DailyRunTime: NewString("15:04"),
|
||||
BatchSize: NewInt(100),
|
||||
GlobalRelayEmailAddress: NewString("test@mattermost.com"),
|
||||
EnableExport: NewBool(true),
|
||||
ExportFormat: NewString(COMPLIANCE_EXPORT_TYPE_GLOBALRELAY),
|
||||
ExportFromTimestamp: NewInt64(0),
|
||||
DailyRunTime: NewString("15:04"),
|
||||
BatchSize: NewInt(100),
|
||||
}
|
||||
|
||||
// should pass because everything is valid
|
||||
require.Nil(t, mes.isValid(*fs))
|
||||
// should fail because globalrelay settings are missing
|
||||
require.Error(t, mes.isValid(*fs))
|
||||
}
|
||||
|
||||
func TestMessageExportSettingsIsValidGlobalRelaySettingsInvalidCustomerType(t *testing.T) {
|
||||
fs := &FileSettings{
|
||||
DriverName: NewString("foo"), // bypass file location check
|
||||
}
|
||||
mes := &MessageExportSettings{
|
||||
EnableExport: NewBool(true),
|
||||
ExportFormat: NewString(COMPLIANCE_EXPORT_TYPE_GLOBALRELAY),
|
||||
ExportFromTimestamp: NewInt64(0),
|
||||
DailyRunTime: NewString("15:04"),
|
||||
BatchSize: NewInt(100),
|
||||
GlobalRelaySettings: &GlobalRelayMessageExportSettings{
|
||||
CustomerType: NewString("Invalid"),
|
||||
EmailAddress: NewString("valid@mattermost.com"),
|
||||
SmtpUsername: NewString("SomeUsername"),
|
||||
SmtpPassword: NewString("SomePassword"),
|
||||
},
|
||||
}
|
||||
|
||||
// should fail because customer type is invalid
|
||||
require.Error(t, mes.isValid(*fs))
|
||||
}
|
||||
|
||||
// func TestMessageExportSettingsIsValidGlobalRelaySettingsInvalidEmailAddress(t *testing.T) {
|
||||
func TestMessageExportSettingsGlobalRelaySettings(t *testing.T) {
|
||||
fs := &FileSettings{
|
||||
DriverName: NewString("foo"), // bypass file location check
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
value *GlobalRelayMessageExportSettings
|
||||
success bool
|
||||
}{
|
||||
{
|
||||
"Invalid email address",
|
||||
&GlobalRelayMessageExportSettings{
|
||||
CustomerType: NewString(GLOBALRELAY_CUSTOMER_TYPE_A9),
|
||||
EmailAddress: NewString("invalidEmailAddress"),
|
||||
SmtpUsername: NewString("SomeUsername"),
|
||||
SmtpPassword: NewString("SomePassword"),
|
||||
},
|
||||
false,
|
||||
},
|
||||
{
|
||||
"Missing smtp username",
|
||||
&GlobalRelayMessageExportSettings{
|
||||
CustomerType: NewString(GLOBALRELAY_CUSTOMER_TYPE_A10),
|
||||
EmailAddress: NewString("valid@mattermost.com"),
|
||||
SmtpPassword: NewString("SomePassword"),
|
||||
},
|
||||
false,
|
||||
},
|
||||
{
|
||||
"Invalid smtp username",
|
||||
&GlobalRelayMessageExportSettings{
|
||||
CustomerType: NewString(GLOBALRELAY_CUSTOMER_TYPE_A10),
|
||||
EmailAddress: NewString("valid@mattermost.com"),
|
||||
SmtpUsername: NewString(""),
|
||||
SmtpPassword: NewString("SomePassword"),
|
||||
},
|
||||
false,
|
||||
},
|
||||
{
|
||||
"Invalid smtp password",
|
||||
&GlobalRelayMessageExportSettings{
|
||||
CustomerType: NewString(GLOBALRELAY_CUSTOMER_TYPE_A10),
|
||||
EmailAddress: NewString("valid@mattermost.com"),
|
||||
SmtpUsername: NewString("SomeUsername"),
|
||||
SmtpPassword: NewString(""),
|
||||
},
|
||||
false,
|
||||
},
|
||||
{
|
||||
"Valid data",
|
||||
&GlobalRelayMessageExportSettings{
|
||||
CustomerType: NewString(GLOBALRELAY_CUSTOMER_TYPE_A9),
|
||||
EmailAddress: NewString("valid@mattermost.com"),
|
||||
SmtpUsername: NewString("SomeUsername"),
|
||||
SmtpPassword: NewString("SomePassword"),
|
||||
},
|
||||
true,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
mes := &MessageExportSettings{
|
||||
EnableExport: NewBool(true),
|
||||
ExportFormat: NewString(COMPLIANCE_EXPORT_TYPE_GLOBALRELAY),
|
||||
ExportFromTimestamp: NewInt64(0),
|
||||
DailyRunTime: NewString("15:04"),
|
||||
BatchSize: NewInt(100),
|
||||
GlobalRelaySettings: tt.value,
|
||||
}
|
||||
|
||||
if tt.success {
|
||||
require.Nil(t, mes.isValid(*fs))
|
||||
} else {
|
||||
require.Error(t, mes.isValid(*fs))
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestMessageExportSetDefaults(t *testing.T) {
|
||||
|
||||
@@ -56,10 +56,6 @@ func (emoji *Emoji) PreSave() {
|
||||
emoji.UpdateAt = emoji.CreateAt
|
||||
}
|
||||
|
||||
func (emoji *Emoji) PreUpdate() {
|
||||
emoji.UpdateAt = GetMillis()
|
||||
}
|
||||
|
||||
func (emoji *Emoji) ToJson() string {
|
||||
b, _ := json.Marshal(emoji)
|
||||
return string(b)
|
||||
|
||||
@@ -5,5 +5,4 @@ package model
|
||||
|
||||
const (
|
||||
USER_AUTH_SERVICE_LDAP = "ldap"
|
||||
LDAP_SYNC_TASK_NAME = "LDAP Syncronization"
|
||||
)
|
||||
|
||||
@@ -13,15 +13,6 @@ import (
|
||||
"gopkg.in/yaml.v2"
|
||||
)
|
||||
|
||||
const (
|
||||
PLUGIN_CONFIG_TYPE_TEXT = "text"
|
||||
PLUGIN_CONFIG_TYPE_BOOL = "bool"
|
||||
PLUGIN_CONFIG_TYPE_RADIO = "radio"
|
||||
PLUGIN_CONFIG_TYPE_DROPDOWN = "dropdown"
|
||||
PLUGIN_CONFIG_TYPE_GENERATED = "generated"
|
||||
PLUGIN_CONFIG_TYPE_USERNAME = "username"
|
||||
)
|
||||
|
||||
type PluginOption struct {
|
||||
// The display name for the option.
|
||||
DisplayName string `json:"display_name" yaml:"display_name"`
|
||||
@@ -173,6 +164,11 @@ func (m *Manifest) ClientManifest() *Manifest {
|
||||
cm.Name = ""
|
||||
cm.Description = ""
|
||||
cm.Backend = nil
|
||||
if cm.Webapp != nil {
|
||||
cm.Webapp = new(ManifestWebapp)
|
||||
*cm.Webapp = *m.Webapp
|
||||
cm.Webapp.BundlePath = "/static/" + m.Id + "_bundle.js"
|
||||
}
|
||||
return cm
|
||||
}
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ func TestManifestUnmarshal(t *testing.T) {
|
||||
&PluginSetting{
|
||||
Key: "thesetting",
|
||||
DisplayName: "thedisplayname",
|
||||
Type: PLUGIN_CONFIG_TYPE_DROPDOWN,
|
||||
Type: "dropdown",
|
||||
HelpText: "thehelptext",
|
||||
RegenerateHelpText: "theregeneratehelptext",
|
||||
Placeholder: "theplaceholder",
|
||||
@@ -181,7 +181,7 @@ func TestManifestJson(t *testing.T) {
|
||||
&PluginSetting{
|
||||
Key: "thesetting",
|
||||
DisplayName: "thedisplayname",
|
||||
Type: PLUGIN_CONFIG_TYPE_DROPDOWN,
|
||||
Type: "dropdown",
|
||||
HelpText: "thehelptext",
|
||||
RegenerateHelpText: "theregeneratehelptext",
|
||||
Placeholder: "theplaceholder",
|
||||
@@ -246,7 +246,7 @@ func TestManifestClientManifest(t *testing.T) {
|
||||
&PluginSetting{
|
||||
Key: "thesetting",
|
||||
DisplayName: "thedisplayname",
|
||||
Type: PLUGIN_CONFIG_TYPE_DROPDOWN,
|
||||
Type: "dropdown",
|
||||
HelpText: "thehelptext",
|
||||
RegenerateHelpText: "theregeneratehelptext",
|
||||
Placeholder: "theplaceholder",
|
||||
|
||||
@@ -6,6 +6,7 @@ package model
|
||||
type MessageExport struct {
|
||||
ChannelId *string
|
||||
ChannelDisplayName *string
|
||||
ChannelType *string
|
||||
|
||||
UserId *string
|
||||
UserEmail *string
|
||||
|
||||
@@ -141,17 +141,6 @@ func OAuthAppFromJson(data io.Reader) *OAuthApp {
|
||||
return app
|
||||
}
|
||||
|
||||
func OAuthAppMapToJson(a map[string]*OAuthApp) string {
|
||||
b, _ := json.Marshal(a)
|
||||
return string(b)
|
||||
}
|
||||
|
||||
func OAuthAppMapFromJson(data io.Reader) map[string]*OAuthApp {
|
||||
var apps map[string]*OAuthApp
|
||||
json.NewDecoder(data).Decode(&apps)
|
||||
return apps
|
||||
}
|
||||
|
||||
func OAuthAppListToJson(l []*OAuthApp) string {
|
||||
b, _ := json.Marshal(l)
|
||||
return string(b)
|
||||
|
||||
@@ -11,9 +11,6 @@ import (
|
||||
const (
|
||||
USER_AUTH_SERVICE_SAML = "saml"
|
||||
USER_AUTH_SERVICE_SAML_TEXT = "With SAML"
|
||||
SAML_IDP_CERTIFICATE = 1
|
||||
SAML_PRIVATE_KEY = 2
|
||||
SAML_PUBLIC_CERT = 3
|
||||
)
|
||||
|
||||
type SamlAuthRequest struct {
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"regexp"
|
||||
"strings"
|
||||
)
|
||||
@@ -20,11 +19,6 @@ type SearchParams struct {
|
||||
OrTerms bool
|
||||
}
|
||||
|
||||
func (o *SearchParams) ToJson() string {
|
||||
b, _ := json.Marshal(o)
|
||||
return string(b)
|
||||
}
|
||||
|
||||
var searchFlags = [...]string{"from", "channel", "in"}
|
||||
|
||||
func splitWords(text string) []string {
|
||||
|
||||
@@ -243,15 +243,6 @@ func (o *Team) Sanitize() {
|
||||
o.AllowedDomains = ""
|
||||
}
|
||||
|
||||
func (o *Team) SanitizeForNotLoggedIn() {
|
||||
o.Email = ""
|
||||
o.AllowedDomains = ""
|
||||
o.CompanyName = ""
|
||||
if !o.AllowOpenInvite {
|
||||
o.InviteId = ""
|
||||
}
|
||||
}
|
||||
|
||||
func (t *Team) Patch(patch *TeamPatch) {
|
||||
if patch.DisplayName != nil {
|
||||
t.DisplayName = *patch.DisplayName
|
||||
|
||||
@@ -373,12 +373,6 @@ func (u *User) MakeNonNil() {
|
||||
}
|
||||
}
|
||||
|
||||
func (u *User) AddProp(key string, value string) {
|
||||
u.MakeNonNil()
|
||||
|
||||
u.Props[key] = value
|
||||
}
|
||||
|
||||
func (u *User) AddNotifyProp(key string, value string) {
|
||||
u.MakeNonNil()
|
||||
|
||||
|
||||
@@ -394,9 +394,6 @@ func ClearMentionTags(post string) string {
|
||||
return post
|
||||
}
|
||||
|
||||
var UrlRegex = regexp.MustCompile(`^((?:[a-z]+:\/\/)?(?:(?:[a-z0-9\-]+\.)+(?:[a-z]{2}|aero|arpa|biz|com|coop|edu|gov|info|int|jobs|mil|museum|name|nato|net|org|pro|travel|local|internal))(:[0-9]{1,5})?(?:\/[a-z0-9_\-\.~]+)*(\/([a-z0-9_\-\.]*)(?:\?[a-z0-9+_~\-\.%=&]*)?)?(?:#[a-zA-Z0-9!$&'()*+.=-_~:@/?]*)?)(?:\s+|$)$`)
|
||||
var PartialUrlRegex = regexp.MustCompile(`/([A-Za-z0-9]{26})/([A-Za-z0-9]{26})/((?:[A-Za-z0-9]{26})?.+(?:\.[A-Za-z0-9]{3,})?)`)
|
||||
|
||||
func IsValidHttpUrl(rawUrl string) bool {
|
||||
if strings.Index(rawUrl, "http://") != 0 && strings.Index(rawUrl, "https://") != 0 {
|
||||
return false
|
||||
@@ -409,18 +406,6 @@ func IsValidHttpUrl(rawUrl string) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func IsValidHttpsUrl(rawUrl string) bool {
|
||||
if strings.Index(rawUrl, "https://") != 0 {
|
||||
return false
|
||||
}
|
||||
|
||||
if _, err := url.ParseRequestURI(rawUrl); err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func IsValidTurnOrStunServer(rawUri string) bool {
|
||||
if strings.Index(rawUri, "turn:") != 0 && strings.Index(rawUri, "stun:") != 0 {
|
||||
return false
|
||||
|
||||
@@ -13,6 +13,7 @@ import (
|
||||
// It should be maitained in chronological order with most current
|
||||
// release at the front of the list.
|
||||
var versions = []string{
|
||||
"4.8.0",
|
||||
"4.7.1",
|
||||
"4.7.0",
|
||||
"4.6.0",
|
||||
@@ -106,10 +107,6 @@ func GetPreviousVersion(version string) string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func IsOfficalBuild() bool {
|
||||
return BuildNumber != "_BUILD_NUMBER_"
|
||||
}
|
||||
|
||||
func IsCurrentVersion(versionToCheck string) bool {
|
||||
currentMajor, currentMinor, _ := SplitVersion(CurrentVersion)
|
||||
toCheckMajor, toCheckMinor, _ := SplitVersion(versionToCheck)
|
||||
|
||||
@@ -45,6 +45,8 @@ const (
|
||||
WEBSOCKET_EVENT_PLUGIN_ACTIVATED = "plugin_activated" // EXPERIMENTAL - SUBJECT TO CHANGE
|
||||
WEBSOCKET_EVENT_PLUGIN_DEACTIVATED = "plugin_deactivated" // EXPERIMENTAL - SUBJECT TO CHANGE
|
||||
WEBSOCKET_EVENT_ROLE_UPDATED = "role_updated"
|
||||
WEBSOCKET_EVENT_LICENSE_CHANGED = "license_changed"
|
||||
WEBSOCKET_EVENT_CONFIG_CHANGED = "config_changed"
|
||||
)
|
||||
|
||||
type WebSocketMessage interface {
|
||||
|
||||
Ссылка в новой задаче
Block a user