Этот коммит содержится в:
=Corey Hulen
2015-10-27 22:18:52 -07:00
родитель 940f5c29c7
Коммит bb25056d9a
28 изменённых файлов: 759 добавлений и 141 удалений

Просмотреть файл

@@ -211,8 +211,8 @@ func (c *Client) InviteMembers(invites *Invites) (*Result, *AppError) {
}
}
func (c *Client) UpdateTeamDisplayName(data map[string]string) (*Result, *AppError) {
if r, err := c.DoApiPost("/teams/update_name", MapToJson(data)); err != nil {
func (c *Client) UpdateTeam(team *Team) (*Result, *AppError) {
if r, err := c.DoApiPost("/teams/update", team.ToJson()); err != nil {
return nil, err
} else {
return &Result{r.Header.Get(HEADER_REQUEST_ID),

Просмотреть файл

@@ -123,6 +123,7 @@ type TeamSettings struct {
EnableUserCreation bool
RestrictCreationToDomains string
RestrictTeamNames *bool
EnableTeamListing *bool
}
type Config struct {
@@ -175,6 +176,11 @@ func (o *Config) SetDefaults() {
o.TeamSettings.RestrictTeamNames = new(bool)
*o.TeamSettings.RestrictTeamNames = true
}
if o.TeamSettings.EnableTeamListing == nil {
o.TeamSettings.EnableTeamListing = new(bool)
*o.TeamSettings.EnableTeamListing = false
}
}
func (o *Config) IsValid() *AppError {

Просмотреть файл

@@ -122,7 +122,7 @@ func (o *Team) IsValid(restrictTeamNames bool) *AppError {
return NewAppError("Team.IsValid", "Invalid email", "id="+o.Id)
}
if len(o.DisplayName) > 64 {
if len(o.DisplayName) == 0 || len(o.DisplayName) > 64 {
return NewAppError("Team.IsValid", "Invalid name", "id="+o.Id)
}
@@ -150,10 +150,6 @@ func (o *Team) IsValid(restrictTeamNames bool) *AppError {
return NewAppError("Team.IsValid", "Invalid allowed domains", "id="+o.Id)
}
if len(o.InviteId) > 0 && len(o.InviteId) != 26 {
return NewAppError("Team.IsValid", "Invalid inviate Id", "")
}
return nil
}
@@ -164,6 +160,10 @@ func (o *Team) PreSave() {
o.CreateAt = GetMillis()
o.UpdateAt = o.CreateAt
if len(o.InviteId) == 0 {
o.InviteId = NewId()
}
}
func (o *Team) PreUpdate() {