MM-14415: Removes 'CanLeave' field. (#10426)

Этот коммит содержится в:
Martin Kraft
2019-03-12 08:58:18 -04:00
коммит произвёл GitHub
родитель 62a94d53f4
Коммит ca52ca7016
6 изменённых файлов: 11 добавлений и 99 удалений

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

@@ -29,7 +29,6 @@ type GroupSyncable struct {
// TeamId.
SyncableId string `db:"-" json:"-"`
CanLeave bool `db:"-" json:"can_leave"`
AutoAdd bool `json:"auto_add"`
CreateAt int64 `json:"create_at"`
DeleteAt int64 `json:"delete_at"`
@@ -51,10 +50,6 @@ func (syncable *GroupSyncable) IsValid() *AppError {
if !IsValidId(syncable.SyncableId) {
return NewAppError("GroupSyncable.SyncableIsValid", "model.group_syncable.syncable_id.app_error", nil, "", http.StatusBadRequest)
}
// TODO: Add this validation check for phase 2 of LDAP group sync.
// if syncable.AutoAdd == false && syncable.CanLeave == false {
// return NewAppError("GroupSyncable.SyncableIsValid", "model.group_syncable.invalid_state", nil, "", http.StatusBadRequest)
// }
return nil
}
@@ -74,8 +69,6 @@ func (syncable *GroupSyncable) UnmarshalJSON(b []byte) error {
syncable.Type = GroupSyncableTypeChannel
case "group_id":
syncable.GroupId = value.(string)
case "can_leave":
syncable.CanLeave = value.(bool)
case "auto_add":
syncable.AutoAdd = value.(bool)
default:
@@ -130,15 +123,10 @@ func (syncable *GroupSyncable) MarshalJSON() ([]byte, error) {
}
type GroupSyncablePatch struct {
CanLeave *bool `json:"can_leave"`
AutoAdd *bool `json:"auto_add"`
AutoAdd *bool `json:"auto_add"`
}
func (syncable *GroupSyncable) Patch(patch *GroupSyncablePatch) {
// TODO: Add this validation check for phase 2 of LDAP group sync.
// if patch.CanLeave != nil {
// syncable.CanLeave = *patch.CanLeave
// }
if patch.AutoAdd != nil {
syncable.AutoAdd = *patch.AutoAdd
}