1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

Fix tracked time issues (#11349)

* Fix nil exeption: #11313

* fix 500

* activate test 😆

* move logic
This commit is contained in:
6543
2020-05-09 16:18:44 +02:00
committed by GitHub
parent b9df5da1f4
commit cd4f7ba5bf
3 changed files with 13 additions and 7 deletions

View File

@@ -324,6 +324,10 @@ func DeleteTime(ctx *context.APIContext) {
ctx.Error(http.StatusInternalServerError, "GetTrackedTimeByID", err)
return
}
if time.Deleted {
ctx.NotFound(fmt.Errorf("tracked time [%d] already deleted", time.ID))
return
}
if !ctx.User.IsAdmin && time.UserID != ctx.User.ID {
//Only Admin and User itself can delete their time