mirror of
https://github.com/go-gitea/gitea
synced 2025-08-26 11:28:27 +00:00
Backport #11349 * Fix tracked time issues (#11349) * Fix nil exeption: #11313 * fix 500 * activate test 😆 * move logic * Add missing import Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: Guillermo Prandi <guillep2k@users.noreply.github.com>
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
package repo
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
@@ -296,6 +297,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
|
||||
|
Reference in New Issue
Block a user