diff --git a/api-users.go b/api-users.go index 51f59bd..13aa233 100644 --- a/api-users.go +++ b/api-users.go @@ -525,6 +525,24 @@ func (app *appContext) ExtendExpiry(gc *gin.Context) { base := time.Now() if expiry, ok := app.storage.GetUserExpiryKey(id); ok { base = expiry.Expiry + app.debug.Printf(lm.FoundExistingExpiry) + } else if req.TryExtendFromPreviousExpiry { + var acts []Activity + app.storage.db.Find(&acts, badgerhold.Where("Type").Eq(ActivityDisabled).And("UserID").Eq(id).SortBy("Time").Reverse().Limit(1)) + if len(acts) != 0 { + // Only do it if the most recent reason for disabling was expiry + if acts[0].SourceType == ActivityDaemon { + app.debug.Printf(lm.FoundPreviousExpiryLog, acts[0].Time) + newExpiry := acts[0].Time.AddDate(0, req.Months, req.Days).Add(time.Duration(((60 * req.Hours) + req.Minutes)) * time.Minute) + if newExpiry.After(base) { + base = acts[0].Time + } else { + app.debug.Printf(lm.ExpiryWouldBeInPast) + } + } else { + app.debug.Printf(lm.PreviousExpiryNotExpiry) + } + } } app.debug.Printf(lm.ExtendCreateExpiry, id) expiry := UserExpiry{} diff --git a/css/tooltip.css b/css/tooltip.css index c6a193c..ab4d187 100644 --- a/css/tooltip.css +++ b/css/tooltip.css @@ -6,7 +6,7 @@ .tooltip .content { visibility: hidden; opacity: 0; - max-width: 10rem; + max-width: 16rem; min-width: 6rem; background-color: rgba(0, 0, 0, 0.6); color: #fff; @@ -29,6 +29,7 @@ } .tooltip.above .content { + top: unset; bottom: calc(100% + 0.125rem); left: 50%; right: 0; diff --git a/html/admin.html b/html/admin.html index 8ad6dd6..580963b 100644 --- a/html/admin.html +++ b/html/admin.html @@ -186,56 +186,60 @@