예제 #1
0
/**
 * GetZoneInfo Get all ZoneInfo in the specified list.
 **/
func (m *Manager) GetZoneList() []string {
	var list []string
	for _, zdesc := range zoneWhiteList {
		if !zoneinfo.IsZoneValid(zdesc.zone) {
			continue
		}
		list = append(list, zdesc.zone)
	}

	return list
}
예제 #2
0
/**
 * DeleteUserTimezone Delete the specified time zone from user time zone list.
 **/
func (m *Manager) DeleteUserTimezone(zone string) error {
	if !zoneinfo.IsZoneValid(zone) {
		logger.Debug("Invalid zone:", zone)
		return zoneinfo.ErrZoneInvalid
	}

	oldList := m.UserTimezones.Get()
	newList, deleted := deleteItemFromList(zone, oldList)
	if deleted {
		m.settings.SetStrv(settingsKeyTimezoneList, newList)
	}
	return nil
}