Add the keep 0 days feature.

This commit is contained in:
lishuang 2021-01-02 17:10:49 +08:00
parent e1e46457e7
commit 847bcd746c
3 changed files with 13 additions and 2 deletions

View File

@ -373,7 +373,7 @@ func (this *DavService) HandleDelete(w http.ResponseWriter, r *http.Request, use
matter := this.matterDao.CheckWithRootByPath(subPath, user)
this.matterService.AtomicSoftDelete(r, matter, user)
this.matterService.AtomicDelete(r, matter, user)
}
//crate a directory

View File

@ -79,6 +79,7 @@ func (this *MatterController) RegisterRoutes() map[string]func(writer http.Respo
routeMap["/api/matter/recovery/batch"] = this.Wrap(this.RecoveryBatch, USER_ROLE_USER)
routeMap["/api/matter/delete"] = this.Wrap(this.Delete, USER_ROLE_USER)
routeMap["/api/matter/delete/batch"] = this.Wrap(this.DeleteBatch, USER_ROLE_USER)
routeMap["/api/matter/clean/expired/deleted/matters"] = this.Wrap(this.CleanExpiredDeletedMatters, USER_ROLE_ADMINISTRATOR)
routeMap["/api/matter/rename"] = this.Wrap(this.Rename, USER_ROLE_USER)
routeMap["/api/matter/change/privacy"] = this.Wrap(this.ChangePrivacy, USER_ROLE_USER)
routeMap["/api/matter/move"] = this.Wrap(this.Move, USER_ROLE_USER)
@ -449,6 +450,14 @@ func (this *MatterController) DeleteBatch(writer http.ResponseWriter, request *h
return this.Success("OK")
}
//manual clean expired deleted matters.
func (this *MatterController) CleanExpiredDeletedMatters(writer http.ResponseWriter, request *http.Request) *result.WebResult {
this.matterService.CleanExpiredDeletedMatters()
return this.Success("OK")
}
func (this *MatterController) Rename(writer http.ResponseWriter, request *http.Request) *result.WebResult {
uuid := request.FormValue("uuid")

View File

@ -1303,7 +1303,9 @@ func (this *MatterService) CleanExpiredDeletedMatters() {
thenDate := time.Now()
thenDate = thenDate.AddDate(0, 0, int(-preference.DeletedKeepDays))
thenDate = util.FirstSecondOfDay(thenDate)
if preference.DeletedKeepDays != 0 {
thenDate = util.FirstSecondOfDay(thenDate)
}
//first remove all the matter(not dir).
this.matterDao.PageHandle("", "", "", FALSE, TRUE, &thenDate, nil, func(matter *Matter) {