mirror of
https://github.com/go-gitea/gitea
synced 2024-06-03 03:46:51 +02:00
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.add_time_estimate = `3w 4d 12h`
|
||||||
issues.change_time_estimate_at = `changed time estimate to <b>%s</b> %s`
|
issues.change_time_estimate_at = `changed time estimate to <b>%s</b> %s`
|
||||||
issues.remove_time_estimate = `removed time estimate %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.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.remove_ref_at = `removed reference <b>%s</b> %s`
|
||||||
issues.add_ref_at = `added 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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
url := issue.Link()
|
||||||
|
|
||||||
timeStr := ctx.FormString("time_estimate")
|
timeStr := ctx.FormString("time_estimate")
|
||||||
|
|
||||||
// Validate input
|
// Validate input
|
||||||
rTimeStr := regexp.MustCompile(`^([\d]+w)?\s?([\d]+d)?\s?([\d]+h)?\s?([\d]+m)?$`)
|
rTimeStr := regexp.MustCompile(`^([\d]+w)?\s?([\d]+d)?\s?([\d]+h)?\s?([\d]+m)?$`)
|
||||||
if !rTimeStr.MatchString(timeStr) {
|
rTimeStrHoursOnly := regexp.MustCompile(`^([\d]+)$`)
|
||||||
ctx.JSON(http.StatusOK, map[string]interface{}{
|
if !rTimeStr.MatchString(timeStr) && !rTimeStrHoursOnly.MatchString(timeStr) {
|
||||||
"status": "ok",
|
ctx.Flash.Error(ctx.Tr("repo.issues.time_estimate_invalid"))
|
||||||
})
|
ctx.Redirect(url, http.StatusSeeOther)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
total := issue.TimeEstimateFromStr(timeStr)
|
total := issue.TimeEstimateFromStr(timeStr)
|
||||||
|
|
||||||
// User entered something wrong
|
// User entered something wrong
|
||||||
if total == 0 && len(timeStr) != 0 {
|
if total == 0 && len(timeStr) != 0 {
|
||||||
ctx.JSON(http.StatusOK, map[string]interface{}{
|
ctx.Flash.Error(ctx.Tr("repo.issues.time_estimate_invalid"))
|
||||||
"status": "ok",
|
ctx.Redirect(url, http.StatusSeeOther)
|
||||||
})
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// No time changed
|
||||||
if issue.TimeEstimate == total {
|
if issue.TimeEstimate == total {
|
||||||
ctx.JSON(http.StatusOK, map[string]interface{}{
|
ctx.Redirect(url, http.StatusSeeOther)
|
||||||
"status": "ok",
|
|
||||||
})
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2019,9 +2021,7 @@ func UpdateIssueTimeEstimate(ctx *context.Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.JSON(http.StatusOK, map[string]interface{}{
|
ctx.Redirect(url, http.StatusSeeOther)
|
||||||
"status": "ok",
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// UpdateIssueRef change issue's ref (branch)
|
// 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() {
|
export function initRepoIssueBranchSelect() {
|
||||||
const changeBranchSelect = function () {
|
const changeBranchSelect = function () {
|
||||||
const selectionTextField = $('#pull-target-branch');
|
const selectionTextField = $('#pull-target-branch');
|
||||||
|
|
|
@ -4,7 +4,7 @@ import {initCompMarkupContentPreviewTab} from './comp/MarkupContentPreview.js';
|
||||||
import {initEasyMDEImagePaste} from './comp/ImagePaste.js';
|
import {initEasyMDEImagePaste} from './comp/ImagePaste.js';
|
||||||
import {
|
import {
|
||||||
initRepoIssueBranchSelect, initRepoIssueCodeCommentCancel, initRepoIssueCommentDelete,
|
initRepoIssueBranchSelect, initRepoIssueCodeCommentCancel, initRepoIssueCommentDelete,
|
||||||
initRepoIssueComments, initRepoIssueDependencyDelete, initRepoIssueTimeEstimateEdit, initRepoIssueReferenceIssue,
|
initRepoIssueComments, initRepoIssueDependencyDelete, initRepoIssueReferenceIssue,
|
||||||
initRepoIssueStatusButton, initRepoIssueTitleEdit, initRepoIssueWipToggle,
|
initRepoIssueStatusButton, initRepoIssueTitleEdit, initRepoIssueWipToggle,
|
||||||
initRepoPullRequestUpdate, updateIssuesMeta,
|
initRepoPullRequestUpdate, updateIssuesMeta,
|
||||||
} from './repo-issue.js';
|
} from './repo-issue.js';
|
||||||
|
@ -562,7 +562,6 @@ export function initRepository() {
|
||||||
initRepoIssueTitleEdit();
|
initRepoIssueTitleEdit();
|
||||||
initRepoIssueWipToggle();
|
initRepoIssueWipToggle();
|
||||||
initRepoIssueComments();
|
initRepoIssueComments();
|
||||||
initRepoIssueTimeEstimateEdit();
|
|
||||||
|
|
||||||
initRepoDiffConversationNav();
|
initRepoDiffConversationNav();
|
||||||
initRepoIssueReferenceIssue();
|
initRepoIssueReferenceIssue();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user