Fix quota odd behaviour

This commit is contained in:
2019-01-16 15:31:22 +01:00
parent 4f50c4817a
commit dd062fe989
6 changed files with 39 additions and 11 deletions

View File

@ -113,7 +113,7 @@ type Users interface {
UpdateWebSite(name string, website string) error
UpdateTwitter(name string, twitter string) error
UpdatePassword(name string, password string) error
UpdateQuota(name string, quota int) error
UpdateQuota(name string, quota int64) error
GroupList(name string) ([]string, error)
GroupAdd(name string, group string) error
GroupRemove(name string, group string) error

View File

@ -394,11 +394,11 @@ func (_m *Users) UpdatePhone(name string, phone string) error {
}
// UpdateQuota provides a mock function with given fields: name, quota
func (_m *Users) UpdateQuota(name string, quota int) error {
func (_m *Users) UpdateQuota(name string, quota int64) error {
ret := _m.Called(name, quota)
var r0 error
if rf, ok := ret.Get(0).(func(string, int) error); ok {
if rf, ok := ret.Get(0).(func(string, int64) error); ok {
r0 = rf(name, quota)
} else {
r0 = ret.Error(0)

View File

@ -1,5 +1,7 @@
package types
import "strconv"
//User encapsulate the data needed to create a new Nextcloud's User
type User struct {
Username string
@ -38,3 +40,10 @@ type Quota struct {
Relative float64 `json:"relative"`
Quota int64 `json:"quota"`
}
func (q *Quota) String() string {
if q.Quota < 0 {
return "none"
}
return strconv.FormatInt(q.Quota, 10)
}