summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--models/issue_stopwatch.go10
-rw-r--r--modules/structs/issue_stopwatch.go7
-rw-r--r--templates/swagger/v1_json.tmpl12
3 files changed, 25 insertions, 4 deletions
diff --git a/models/issue_stopwatch.go b/models/issue_stopwatch.go
index 79ce48c4cd..f80ce4139c 100644
--- a/models/issue_stopwatch.go
+++ b/models/issue_stopwatch.go
@@ -201,9 +201,15 @@ func (sw *Stopwatch) APIFormat() (api.StopWatch, error) {
if err != nil {
return api.StopWatch{}, err
}
+ if err := issue.LoadRepo(); err != nil {
+ return api.StopWatch{}, err
+ }
return api.StopWatch{
- Created: sw.CreatedUnix.AsTime(),
- IssueIndex: issue.Index,
+ Created: sw.CreatedUnix.AsTime(),
+ IssueIndex: issue.Index,
+ IssueTitle: issue.Title,
+ RepoOwnerName: issue.Repo.OwnerName,
+ RepoName: issue.Repo.Name,
}, nil
}
diff --git a/modules/structs/issue_stopwatch.go b/modules/structs/issue_stopwatch.go
index 10510e36ef..8599e07273 100644
--- a/modules/structs/issue_stopwatch.go
+++ b/modules/structs/issue_stopwatch.go
@@ -11,8 +11,11 @@ import (
// StopWatch represent a running stopwatch
type StopWatch struct {
// swagger:strfmt date-time
- Created time.Time `json:"created"`
- IssueIndex int64 `json:"issue_index"`
+ Created time.Time `json:"created"`
+ IssueIndex int64 `json:"issue_index"`
+ IssueTitle string `json:"issue_title"`
+ RepoOwnerName string `json:"repo_owner_name"`
+ RepoName string `json:"repo_name"`
}
// StopWatches represent a list of stopwatches
diff --git a/templates/swagger/v1_json.tmpl b/templates/swagger/v1_json.tmpl
index 3c563aa673..09acd3a0a5 100644
--- a/templates/swagger/v1_json.tmpl
+++ b/templates/swagger/v1_json.tmpl
@@ -14698,6 +14698,18 @@
"type": "integer",
"format": "int64",
"x-go-name": "IssueIndex"
+ },
+ "issue_title": {
+ "type": "string",
+ "x-go-name": "IssueTitle"
+ },
+ "repo_name": {
+ "type": "string",
+ "x-go-name": "RepoName"
+ },
+ "repo_owner_name": {
+ "type": "string",
+ "x-go-name": "RepoOwnerName"
}
},
"x-go-package": "code.gitea.io/gitea/modules/structs"