-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue due date api #3890
Merged
Merged
Issue due date api #3890
Changes from 48 commits
Commits
Show all changes
52 commits
Select commit
Hold shift + click to select a range
1a905b2
Implemented basic api endpoint to manage deadlines
kolaente 794ac07
Fixed checking for permissions
kolaente cf3313b
Merge branch 'master' of https://github.com/go-gitea/gitea into issue…
kolaente d27bb3e
Updating a deadline from the ui is now entirely done via the api
kolaente 6c32b3d
cleanup
kolaente 51cd3d7
Cosmetics
kolaente 11bb494
fixed lint + fmt
kolaente 4a31c8a
Merge branch 'master' of https://github.com/go-gitea/gitea into issue…
kolaente 3f67df2
Added swagger model definition for deadline response
kolaente 037ce0c
Merge branch 'master' of https://github.com/go-gitea/gitea into issue…
kolaente 6ce65e5
Updated gitea-sdk
kolaente 24cb3ce
Updated gitea-sdk
kolaente 16d1c50
More cleanup
kolaente 996432f
Generate swagger json
kolaente 7038340
Merge branch 'master' of https://github.com/go-gitea/gitea into issue…
kolaente 1279e04
Merge branch 'master' of https://github.com/go-gitea/gitea into issue…
kolaente 6aa29b0
Merge branch 'master' of https://github.com/go-gitea/gitea into issue…
kolaente ead7b64
Merge branch 'master' of https://github.com/go-gitea/gitea into issue…
kolaente 464de27
Merge branch 'master' of https://github.com/go-gitea/gitea into issue…
kolaente 83c9187
Merge branch 'master' of https://github.com/go-gitea/gitea into issue…
kolaente c2fbe8f
Fixed permission to update a deadline via api
kolaente 93b71d8
Re-added form to change a deadline
kolaente b05b423
Added client-side validation + not ignore error messages from the api
kolaente 6294c86
Added locale for error message
kolaente e7734b2
Merge branch 'master' of https://github.com/go-gitea/gitea into issue…
kolaente c42c28d
Merge branch 'master' of https://github.com/go-gitea/gitea
kolaente 0bf271b
Merge branch 'master' of https://github.com/go-gitea/gitea
kolaente 8111fdf
Merge branch 'master' into issue-due-date-api
kolaente bb848c5
Merge remote-tracking branch 'upstream/master' into issue-due-date-api
kolaente 1bf3c47
Merge branch 'master' of https://github.com/go-gitea/gitea into issue…
kolaente 5ea7b84
Proper date validation
kolaente 541519d
Fixed indention
kolaente d8ab59e
moved css to css file
kolaente bbc51dc
Merge branch 'issue-due-date-api' of https://github.com/kolaente/gite…
kolaente 6a7bffa
Merge branch 'master' into issue-due-date-api
kolaente ca83a54
added documentation for error codes
kolaente e2212ed
Merge remote-tracking branch 'upstream/master' into issue-due-date-api
kolaente b63232f
Merge remote-tracking branch 'upstream/master' into issue-due-date-api
kolaente e55d4a1
after merge cleanup
kolaente 4d7a636
Merge branch 'issue-due-date-api' of https://github.com/kolaente/gite…
kolaente ab27aff
Merge branch 'master' into issue-due-date-api
kolaente a09582e
Merge remote-tracking branch 'upstream/master' into issue-due-date-api
kolaente 3a9d32a
Added swagger description
kolaente 5a084ad
Merge branch 'issue-due-date-api' of https://github.com/kolaente/gite…
kolaente 1884670
DO NOTHING BUT TRIGGER THAT F*CKIN CI SO IT PICKS UP THE LATEST COMMI…
kolaente d946547
DO NOTHING BUT TRIGGER THAT F*CKIN CI SO IT PICKS UP THE LATEST COMMI…
kolaente 6b6203e
Merge branch 'master' into issue-due-date-api
kolaente 10aa70e
Merge branch 'master' of https://github.com/go-gitea/gitea into issue…
kolaente 75ff80d
Merge branch 'master' of https://github.com/go-gitea/gitea into issue…
jonasfranz 980880c
Merge branch 'master' into issue-due-date-api
lafriks 6396a6f
Merge branch 'master' of github.com:go-gitea/gitea into issue-due-dat…
kolaente d0c94ec
regenerated stylesheets
kolaente File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -278,7 +278,7 @@ func EditIssue(ctx *context.APIContext, form api.EditIssueOption) { | |
|
||
// Update the deadline | ||
var deadlineUnix util.TimeStamp | ||
if form.Deadline != nil && !form.Deadline.IsZero() { | ||
if form.Deadline != nil && !form.Deadline.IsZero() && ctx.Repo.IsWriter() { | ||
deadlineUnix = util.TimeStamp(form.Deadline.Unix()) | ||
} | ||
|
||
|
@@ -338,3 +338,72 @@ func EditIssue(ctx *context.APIContext, form api.EditIssueOption) { | |
} | ||
ctx.JSON(201, issue.APIFormat()) | ||
} | ||
|
||
// UpdateIssueDeadline updates an issue deadline | ||
func UpdateIssueDeadline(ctx *context.APIContext, form api.EditDeadlineOption) { | ||
// swagger:operation POST /repos/{owner}/{repo}/issues/{index}/deadline issue issueEditIssueDeadline | ||
// --- | ||
// summary: Set an issue deadline. If set to null, the deadline is deleted. | ||
// consumes: | ||
// - application/json | ||
// produces: | ||
// - application/json | ||
// parameters: | ||
// - name: owner | ||
// in: path | ||
// description: owner of the repo | ||
// type: string | ||
// required: true | ||
// - name: repo | ||
// in: path | ||
// description: name of the repo | ||
// type: string | ||
// required: true | ||
// - name: index | ||
// in: path | ||
// description: index of the issue to create or update a deadline on | ||
// type: integer | ||
// required: true | ||
// - name: body | ||
// in: body | ||
// schema: | ||
// "$ref": "#/definitions/EditDeadlineOption" | ||
// responses: | ||
// "201": | ||
// "$ref": "#/responses/IssueDeadline" | ||
// "403": | ||
// description: Not repo writer | ||
// schema: | ||
// "$ref": "#/responses/forbidden" | ||
// "404": | ||
// description: Issue not found | ||
// schema: | ||
// "$ref": "#/responses/empty" | ||
|
||
issue, err := models.GetIssueByIndex(ctx.Repo.Repository.ID, ctx.ParamsInt64(":index")) | ||
if err != nil { | ||
if models.IsErrIssueNotExist(err) { | ||
ctx.Status(404) | ||
} else { | ||
ctx.Error(500, "GetIssueByIndex", err) | ||
} | ||
return | ||
} | ||
|
||
if !ctx.Repo.IsWriter() { | ||
ctx.Status(403) | ||
return | ||
} | ||
|
||
var deadlineUnix util.TimeStamp | ||
if form.Deadline != nil && !form.Deadline.IsZero() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Move this to validation function of form. |
||
deadlineUnix = util.TimeStamp(form.Deadline.Unix()) | ||
} | ||
|
||
if err := models.UpdateIssueDeadline(issue, deadlineUnix, ctx.User); err != nil { | ||
ctx.Error(500, "UpdateIssueDeadline", err) | ||
return | ||
} | ||
|
||
ctx.JSON(201, api.IssueDeadline{Deadline: form.Deadline}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this to validation function of the form.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What validation in what form? You mean the form I use to change the deadline in the frontend?