mirror of https://github.com/go-gitea/gitea
Commit
This commit is contained in:
parent
8ef3a478aa
commit
49a176d37c
|
@ -1305,6 +1305,7 @@ issues.time_estimate = `Time Estimate`
|
|||
issues.add_time_estimate = `3w 4d 12h`
|
||||
issues.change_time_estimate_at = `changed time estimate to <b>%s</b> %s`
|
||||
issues.remove_time_estimate = `removed time estimate %s`
|
||||
issues.time_estimate_invalid = `Time estimate format is invalid`
|
||||
issues.change_ref_at = `changed reference from <b><strike>%s</strike></b> to <b>%s</b> %s`
|
||||
issues.remove_ref_at = `removed reference <b>%s</b> %s`
|
||||
issues.add_ref_at = `added reference <b>%s</b> %s`
|
||||
|
|
|
@ -1988,29 +1988,31 @@ func UpdateIssueTimeEstimate(ctx *context.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
url := issue.Link()
|
||||
|
||||
timeStr := ctx.FormString("time_estimate")
|
||||
|
||||
// Validate input
|
||||
rTimeStr := regexp.MustCompile(`^([\d]+w)?\s?([\d]+d)?\s?([\d]+h)?\s?([\d]+m)?$`)
|
||||
if !rTimeStr.MatchString(timeStr) {
|
||||
ctx.JSON(http.StatusOK, map[string]interface{}{
|
||||
"status": "ok",
|
||||
})
|
||||
rTimeStrHoursOnly := regexp.MustCompile(`^([\d]+)$`)
|
||||
if !rTimeStr.MatchString(timeStr) && !rTimeStrHoursOnly.MatchString(timeStr) {
|
||||
ctx.Flash.Error(ctx.Tr("repo.issues.time_estimate_invalid"))
|
||||
ctx.Redirect(url, http.StatusSeeOther)
|
||||
return
|
||||
}
|
||||
|
||||
total := issue.TimeEstimateFromStr(timeStr)
|
||||
|
||||
// User entered something wrong
|
||||
if total == 0 && len(timeStr) != 0 {
|
||||
ctx.JSON(http.StatusOK, map[string]interface{}{
|
||||
"status": "ok",
|
||||
})
|
||||
ctx.Flash.Error(ctx.Tr("repo.issues.time_estimate_invalid"))
|
||||
ctx.Redirect(url, http.StatusSeeOther)
|
||||
return
|
||||
}
|
||||
|
||||
// No time changed
|
||||
if issue.TimeEstimate == total {
|
||||
ctx.JSON(http.StatusOK, map[string]interface{}{
|
||||
"status": "ok",
|
||||
})
|
||||
ctx.Redirect(url, http.StatusSeeOther)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -2019,9 +2021,7 @@ func UpdateIssueTimeEstimate(ctx *context.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
ctx.JSON(http.StatusOK, map[string]interface{}{
|
||||
"status": "ok",
|
||||
})
|
||||
ctx.Redirect(url, http.StatusSeeOther)
|
||||
}
|
||||
|
||||
// UpdateIssueRef change issue's ref (branch)
|
||||
|
|
|
@ -639,23 +639,6 @@ export function initRepoIssueTitleEdit() {
|
|||
});
|
||||
}
|
||||
|
||||
export function initRepoIssueTimeEstimateEdit() {
|
||||
$('#set_time_estimate_form').on('submit', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
const timeEstimate = $(this).find('[name=time_estimate]').val();
|
||||
|
||||
$.post($(this).attr('action'), {
|
||||
_csrf: csrfToken,
|
||||
time_estimate: timeEstimate,
|
||||
}).always(() => {
|
||||
window.location.reload();
|
||||
});
|
||||
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
export function initRepoIssueBranchSelect() {
|
||||
const changeBranchSelect = function () {
|
||||
const selectionTextField = $('#pull-target-branch');
|
||||
|
|
|
@ -4,7 +4,7 @@ import {initCompMarkupContentPreviewTab} from './comp/MarkupContentPreview.js';
|
|||
import {initEasyMDEImagePaste} from './comp/ImagePaste.js';
|
||||
import {
|
||||
initRepoIssueBranchSelect, initRepoIssueCodeCommentCancel, initRepoIssueCommentDelete,
|
||||
initRepoIssueComments, initRepoIssueDependencyDelete, initRepoIssueTimeEstimateEdit, initRepoIssueReferenceIssue,
|
||||
initRepoIssueComments, initRepoIssueDependencyDelete, initRepoIssueReferenceIssue,
|
||||
initRepoIssueStatusButton, initRepoIssueTitleEdit, initRepoIssueWipToggle,
|
||||
initRepoPullRequestUpdate, updateIssuesMeta,
|
||||
} from './repo-issue.js';
|
||||
|
@ -562,7 +562,6 @@ export function initRepository() {
|
|||
initRepoIssueTitleEdit();
|
||||
initRepoIssueWipToggle();
|
||||
initRepoIssueComments();
|
||||
initRepoIssueTimeEstimateEdit();
|
||||
|
||||
initRepoDiffConversationNav();
|
||||
initRepoIssueReferenceIssue();
|
||||
|
|
Loading…
Reference in New Issue