Fix tracked time issues (#11349)
* Fix nil exeption: #11313 * fix 500 * activate test 😆 * move logic
This commit is contained in:
parent
b9df5da1f4
commit
cd4f7ba5bf
3 changed files with 13 additions and 7 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue