From 1363205f29b357c6e4f4517d69faca93c98b04ee Mon Sep 17 00:00:00 2001 From: stuzer05 Date: Fri, 24 Feb 2023 12:06:12 +0200 Subject: [PATCH 01/59] Commit --- models/issues/comment.go | 10 ++++++ models/issues/issue.go | 35 +++++++++++++++++++ modules/structs/issue.go | 8 +++-- options/locale/locale_en-US.ini | 3 ++ options/locale/locale_ru-RU.ini | 3 ++ options/locale/locale_uk-UA.ini | 5 ++- routers/web/repo/issue.go | 26 ++++++++++++++ routers/web/web.go | 1 + services/issue/issue.go | 15 ++++++++ .../repo/issue/view_content/comments.tmpl | 13 +++++++ .../repo/issue/view_content/sidebar.tmpl | 15 ++++++++ web_src/js/features/repo-issue.js | 21 +++++++++++ web_src/js/features/repo-legacy.js | 3 +- 13 files changed, 154 insertions(+), 4 deletions(-) diff --git a/models/issues/comment.go b/models/issues/comment.go index a47dc7c151340..015bb78f80785 100644 --- a/models/issues/comment.go +++ b/models/issues/comment.go @@ -130,6 +130,8 @@ const ( CommentTypePRScheduledToAutoMerge // 35 pr was un scheduled to auto merge when checks succeed CommentTypePRUnScheduledToAutoMerge + // 36 Change plan time + CommentTypeChangePlanTime ) var commentStrings = []string{ @@ -144,6 +146,7 @@ var commentStrings = []string{ "milestone", "assignees", "change_title", + "change_plan_time", "delete_branch", "start_tracking", "stop_tracking", @@ -301,6 +304,9 @@ type Comment struct { NewCommit string `xorm:"-"` CommitsNum int64 `xorm:"-"` IsForcePush bool `xorm:"-"` + + PlanTimeHours int + PlanTimeMinutes int } func init() { @@ -819,6 +825,8 @@ func CreateComment(ctx context.Context, opts *CreateCommentOptions) (_ *Comment, RefIsPull: opts.RefIsPull, IsForcePush: opts.IsForcePush, Invalidated: opts.Invalidated, + PlanTimeHours: opts.PlanTimeHours, + PlanTimeMinutes: opts.PlanTimeMinutes, } if _, err = e.Insert(comment); err != nil { return nil, err @@ -990,6 +998,8 @@ type CreateCommentOptions struct { RefIsPull bool IsForcePush bool Invalidated bool + PlanTimeHours int + PlanTimeMinutes int } // GetCommentByID returns the comment by given ID. diff --git a/models/issues/issue.go b/models/issues/issue.go index c59e9d14e5370..2061c4a99c976 100644 --- a/models/issues/issue.go +++ b/models/issues/issue.go @@ -146,6 +146,10 @@ type Issue struct { // For view issue page. ShowRole RoleDescriptor `xorm:"-"` + + // Plan time + PlanTimeHours int + PlanTimeMinutes int } var ( @@ -774,6 +778,37 @@ func ChangeIssueTitle(issue *Issue, doer *user_model.User, oldTitle string) (err return committer.Commit() } +// ChangeIssuePlanTime changes the plan time of this issue, as the given user. +func ChangeIssuePlanTime(issue *Issue, doer *user_model.User, planTimeHours int, planTimeMinutes int) (err error) { + ctx, committer, err := db.TxContext(db.DefaultContext) + if err != nil { + return err + } + defer committer.Close() + + if err = UpdateIssueCols(ctx, &Issue{ID: issue.ID, PlanTimeHours: planTimeHours, PlanTimeMinutes: planTimeMinutes}, "plan_time_hours", "plan_time_minutes"); err != nil { + return fmt.Errorf("updateIssueCols: %w", err) + } + + if err = issue.LoadRepo(ctx); err != nil { + return fmt.Errorf("loadRepo: %w", err) + } + + opts := &CreateCommentOptions{ + Type: CommentTypeChangePlanTime, + Doer: doer, + Repo: issue.Repo, + Issue: issue, + PlanTimeHours: planTimeHours, + PlanTimeMinutes: planTimeMinutes, + } + if _, err = CreateComment(ctx, opts); err != nil { + return fmt.Errorf("createComment: %w", err) + } + + return committer.Commit() +} + // ChangeIssueRef changes the branch of this issue, as the given user. func ChangeIssueRef(issue *Issue, doer *user_model.User, oldRef string) (err error) { ctx, committer, err := db.TxContext(db.DefaultContext) diff --git a/modules/structs/issue.go b/modules/structs/issue.go index 48e4e0e7e3695..bf6bbe13b8099 100644 --- a/modules/structs/issue.go +++ b/modules/structs/issue.go @@ -54,6 +54,8 @@ type Issue struct { Attachments []*Attachment `json:"assets"` Labels []*Label `json:"labels"` Milestone *Milestone `json:"milestone"` + PlanTimeHours int64 `json:"plan_time_hours"` + PlanTimeMinutes int64 `json:"plan_time_minutes"` // deprecated Assignee *User `json:"assignee"` Assignees []*User `json:"assignees"` @@ -106,8 +108,10 @@ type EditIssueOption struct { Milestone *int64 `json:"milestone"` State *string `json:"state"` // swagger:strfmt date-time - Deadline *time.Time `json:"due_date"` - RemoveDeadline *bool `json:"unset_due_date"` + Deadline *time.Time `json:"due_date"` + PlanTimeHours int `json:"plan_time_hours"` + PlanTimeMinutes int `json:"plan_time_minutes"` + RemoveDeadline *bool `json:"unset_due_date"` } // EditDeadlineOption options for creating a deadline diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index fbd3068053449..230818cd888c4 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1301,6 +1301,9 @@ issues.add_assignee_at = `was assigned by %s %s` issues.remove_assignee_at = `was unassigned by %s %s` issues.remove_self_assignment = `removed their assignment %s` issues.change_title_at = `changed title from %s to %s %s` +issues.tracker_plan_time = `Time plan` +issues.change_plan_time_at = `changed plan time to %d hour %d minutes %s` +issues.remove_plan_time = `removed plan time %s` issues.change_ref_at = `changed reference from %s to %s %s` issues.remove_ref_at = `removed reference %s %s` issues.add_ref_at = `added reference %s %s` diff --git a/options/locale/locale_ru-RU.ini b/options/locale/locale_ru-RU.ini index f3efcf8c70f41..ab31fe469315a 100644 --- a/options/locale/locale_ru-RU.ini +++ b/options/locale/locale_ru-RU.ini @@ -1216,6 +1216,9 @@ issues.add_assignee_at=`был(а) назначен(а) %s %s` issues.remove_assignee_at=`был снят с назначения %s %s` issues.remove_self_assignment=`убрал(а) их назначение %s` issues.change_title_at=`изменил(а) заголовок с %s на %s %s` +issues.tracker_plan_time = `Время план` +issues.change_plan_time_at=`изменил(а) время план на %d час(ов) %d минут %s` +issues.remove_plan_time = `убрал(а) время план %s` issues.change_ref_at=`изменил(а) ссылку с %s на %s %s` issues.remove_ref_at=`убрал(а) ссылку %s %s` issues.add_ref_at=`добавил(а) ссылку %s %s` diff --git a/options/locale/locale_uk-UA.ini b/options/locale/locale_uk-UA.ini index 0b02a82ec23df..18320f6e9593a 100644 --- a/options/locale/locale_uk-UA.ini +++ b/options/locale/locale_uk-UA.ini @@ -574,7 +574,7 @@ delete_email=Видалити email_deletion=Видалити адресу електронної пошти email_deletion_desc=Електронна адреса та пов'язана з нею інформація буде видалена з вашого облікового запису. Git коміти, здійснені через цю електронну адресу, залишиться без змін. Продовжити? email_deletion_success=Адресу електронної пошти було видалено. -theme_update_success=Тему оновлено. +theme_update_success=Тему оновлено. theme_update_error=Вибрана тема не існує. openid_deletion=Видалити адресу OpenID openid_deletion_desc=Видалення цієї OpenID-адреси з вашого облікового запису забороняє вам входити з ним. Продовжити? @@ -1160,6 +1160,9 @@ issues.add_assignee_at=`був призначений %s %s` issues.remove_assignee_at=`був знятий з призначення %s %s` issues.remove_self_assignment=`видалено призначення %s` issues.change_title_at=`змінився заголовок з %s на %s %s` +issues.tracker_plan_time = `Час план` +issues.change_plan_time_at=`змінив час план на %d годин %d хвилин %s` +issues.remove_plan_time = `видалив час план %s` issues.change_ref_at=`змінив посилання з %s на %s %s` issues.remove_ref_at=`видалив посилання %s %s` issues.add_ref_at=`додав посилання %s %s` diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go index 05ba26a70cda6..6a2807e534bc6 100644 --- a/routers/web/repo/issue.go +++ b/routers/web/repo/issue.go @@ -1970,6 +1970,32 @@ func UpdateIssueTitle(ctx *context.Context) { }) } +// UpdateIssuePlanTime change issue's title +func UpdateIssuePlanTime(ctx *context.Context) { + issue := GetActionIssue(ctx) + if ctx.Written() { + return + } + + if !ctx.IsSigned || (!issue.IsPoster(ctx.Doer.ID) && !ctx.Repo.CanWriteIssuesOrPulls(issue.IsPull)) { + ctx.Error(http.StatusForbidden) + return + } + + planTimeHours := ctx.FormInt("plan_time_hours") + planTimeMinutes := ctx.FormInt("plan_time_minutes") + + if err := issue_service.ChangePlanTime(issue, ctx.Doer, planTimeHours, planTimeMinutes); err != nil { + ctx.ServerError("ChangePlanTime", err) + return + } + + ctx.JSON(http.StatusOK, map[string]interface{}{ + "plan_time_hours": issue.PlanTimeHours, + "plan_time_minutes": issue.PlanTimeMinutes, + }) +} + // UpdateIssueRef change issue's ref (branch) func UpdateIssueRef(ctx *context.Context) { issue := GetActionIssue(ctx) diff --git a/routers/web/web.go b/routers/web/web.go index ff312992dda0f..5cf3f7000cd4f 100644 --- a/routers/web/web.go +++ b/routers/web/web.go @@ -1069,6 +1069,7 @@ func RegisterRoutes(m *web.Route) { // So they can apply their own enable/disable logic on routers. m.Group("/{type:issues|pulls}", func() { m.Group("/{index}", func() { + m.Post("/plan_time", repo.UpdateIssuePlanTime) m.Post("/title", repo.UpdateIssueTitle) m.Post("/content", repo.UpdateIssueContent) m.Post("/deadline", web.Bind(structs.EditDeadlineOption{}), repo.UpdateIssueDeadline) diff --git a/services/issue/issue.go b/services/issue/issue.go index b91ee4fc18b07..edddbecd1b97d 100644 --- a/services/issue/issue.go +++ b/services/issue/issue.go @@ -61,6 +61,21 @@ func ChangeTitle(issue *issues_model.Issue, doer *user_model.User, title string) return nil } +// ChangeTitle changes the title of this issue, as the given user. +func ChangePlanTime(issue *issues_model.Issue, doer *user_model.User, planTimeHours int, planTimeMinutes int) (err error) { + //oldTitle := issue.Title + issue.PlanTimeHours = planTimeHours + issue.PlanTimeMinutes = planTimeMinutes + + if err = issues_model.ChangeIssuePlanTime(issue, doer, planTimeHours, planTimeMinutes); err != nil { + return + } + + //notification.NotifyIssueChangeTitle(db.DefaultContext, doer, issue, oldTitle) + + return nil +} + // ChangeIssueRef changes the branch of this issue, as the given user. func ChangeIssueRef(issue *issues_model.Issue, doer *user_model.User, ref string) error { oldRef := issue.Ref diff --git a/templates/repo/issue/view_content/comments.tmpl b/templates/repo/issue/view_content/comments.tmpl index 94b46bd9f13a9..d7154b7863ed9 100644 --- a/templates/repo/issue/view_content/comments.tmpl +++ b/templates/repo/issue/view_content/comments.tmpl @@ -793,6 +793,19 @@ {{else}}{{$.locale.Tr "repo.pulls.auto_merge_canceled_schedule_comment" $createdStr | Safe}}{{end}} + {{else if eq .Type 1001}} +
+ {{svg "octicon-pencil"}} + {{template "shared/user/avatarlink" Dict "Context" $.Context "user" .Poster}} + + {{template "shared/user/authorlink" .Poster}} + {{if and (eq .PlanTimeHours 0) (eq .PlanTimeMinutes 0)}} + {{$.locale.Tr "repo.issues.remove_plan_time" $createdStr | Safe}} + {{else}} + {{$.locale.Tr "repo.issues.change_plan_time_at" (.PlanTimeHours) (.PlanTimeMinutes) $createdStr | Safe}} + {{end}} + +
{{end}} {{end}} {{end}} diff --git a/templates/repo/issue/view_content/sidebar.tmpl b/templates/repo/issue/view_content/sidebar.tmpl index d9c506243705f..abd5d48a3a28d 100644 --- a/templates/repo/issue/view_content/sidebar.tmpl +++ b/templates/repo/issue/view_content/sidebar.tmpl @@ -358,6 +358,21 @@ {{end}} {{if .Repository.IsTimetrackerEnabled $.Context}} {{if and .CanUseTimetracker (not .Repository.IsArchived)}} +
+
+ {{.locale.Tr "repo.issues.tracker_plan_time"}} + +
+ {{$.CsrfTokenHtml}} +
+ + +
+ +
+
{{.locale.Tr "repo.issues.tracker"}} diff --git a/web_src/js/features/repo-issue.js b/web_src/js/features/repo-issue.js index 4fc8bb5e62d90..79f70ef741750 100644 --- a/web_src/js/features/repo-issue.js +++ b/web_src/js/features/repo-issue.js @@ -639,6 +639,27 @@ export function initRepoIssueTitleEdit() { }); } +export function initRepoIssuePlanTimeEdit() { + $('#set_plan_time_form').on('submit', function(e) { + e.preventDefault(); + + const planTimeHours = $(this).find('[name=plan_time_hours]').val(); + const planTimeMinutes = $(this).find('[name=plan_time_minutes]').val(); + + $.post($(this).attr('action'), { + _csrf: csrfToken, + plan_time_hours: planTimeHours, + plan_time_minutes: planTimeMinutes, + }).done((data) => { + console.log('ok') + }).always(() => { + window.location.reload(); + }); + + return false; + }); +} + export function initRepoIssueBranchSelect() { const changeBranchSelect = function () { const selectionTextField = $('#pull-target-branch'); diff --git a/web_src/js/features/repo-legacy.js b/web_src/js/features/repo-legacy.js index a9229c0d1e6f5..f622abdefd80c 100644 --- a/web_src/js/features/repo-legacy.js +++ b/web_src/js/features/repo-legacy.js @@ -4,7 +4,7 @@ import {initCompMarkupContentPreviewTab} from './comp/MarkupContentPreview.js'; import {initEasyMDEImagePaste} from './comp/ImagePaste.js'; import { initRepoIssueBranchSelect, initRepoIssueCodeCommentCancel, initRepoIssueCommentDelete, - initRepoIssueComments, initRepoIssueDependencyDelete, initRepoIssueReferenceIssue, + initRepoIssueComments, initRepoIssueDependencyDelete, initRepoIssuePlanTimeEdit, initRepoIssueReferenceIssue, initRepoIssueStatusButton, initRepoIssueTitleEdit, initRepoIssueWipToggle, initRepoPullRequestUpdate, updateIssuesMeta, } from './repo-issue.js'; @@ -562,6 +562,7 @@ export function initRepository() { initRepoIssueTitleEdit(); initRepoIssueWipToggle(); initRepoIssueComments(); + initRepoIssuePlanTimeEdit(); initRepoDiffConversationNav(); initRepoIssueReferenceIssue(); From d11ba9f46ce3a1dc9aab36bd46f3003b30bf61d3 Mon Sep 17 00:00:00 2001 From: stuzer05 Date: Fri, 24 Feb 2023 12:10:52 +0200 Subject: [PATCH 02/59] Commit --- web_src/js/features/repo-issue.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/web_src/js/features/repo-issue.js b/web_src/js/features/repo-issue.js index 79f70ef741750..576667b7ea536 100644 --- a/web_src/js/features/repo-issue.js +++ b/web_src/js/features/repo-issue.js @@ -650,8 +650,6 @@ export function initRepoIssuePlanTimeEdit() { _csrf: csrfToken, plan_time_hours: planTimeHours, plan_time_minutes: planTimeMinutes, - }).done((data) => { - console.log('ok') }).always(() => { window.location.reload(); }); From c783692f6cbff0edbfe4001fabfee3f555f3ae22 Mon Sep 17 00:00:00 2001 From: stuzer05 Date: Fri, 24 Feb 2023 12:13:12 +0200 Subject: [PATCH 03/59] Commit --- options/locale/locale_en-US.ini | 6 +++--- options/locale/locale_ru-RU.ini | 6 +++--- options/locale/locale_uk-UA.ini | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 230818cd888c4..94d1b896fec4f 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1301,9 +1301,9 @@ issues.add_assignee_at = `was assigned by %s %s` issues.remove_assignee_at = `was unassigned by %s %s` issues.remove_self_assignment = `removed their assignment %s` issues.change_title_at = `changed title from %s to %s %s` -issues.tracker_plan_time = `Time plan` -issues.change_plan_time_at = `changed plan time to %d hour %d minutes %s` -issues.remove_plan_time = `removed plan time %s` +issues.tracker_plan_time = `Planned time` +issues.change_plan_time_at = `changed planned time to %d hour %d minutes %s` +issues.remove_plan_time = `removed planned time %s` issues.change_ref_at = `changed reference from %s to %s %s` issues.remove_ref_at = `removed reference %s %s` issues.add_ref_at = `added reference %s %s` diff --git a/options/locale/locale_ru-RU.ini b/options/locale/locale_ru-RU.ini index ab31fe469315a..425886f635319 100644 --- a/options/locale/locale_ru-RU.ini +++ b/options/locale/locale_ru-RU.ini @@ -1216,9 +1216,9 @@ issues.add_assignee_at=`был(а) назначен(а) %s %s` issues.remove_assignee_at=`был снят с назначения %s %s` issues.remove_self_assignment=`убрал(а) их назначение %s` issues.change_title_at=`изменил(а) заголовок с %s на %s %s` -issues.tracker_plan_time = `Время план` -issues.change_plan_time_at=`изменил(а) время план на %d час(ов) %d минут %s` -issues.remove_plan_time = `убрал(а) время план %s` +issues.tracker_plan_time = `Запланированное время` +issues.change_plan_time_at=`изменил(а) запланированное время на %d час(ов) %d минут %s` +issues.remove_plan_time = `убрал(а) запланированное время %s` issues.change_ref_at=`изменил(а) ссылку с %s на %s %s` issues.remove_ref_at=`убрал(а) ссылку %s %s` issues.add_ref_at=`добавил(а) ссылку %s %s` diff --git a/options/locale/locale_uk-UA.ini b/options/locale/locale_uk-UA.ini index 18320f6e9593a..51b4f0a102b99 100644 --- a/options/locale/locale_uk-UA.ini +++ b/options/locale/locale_uk-UA.ini @@ -1160,9 +1160,9 @@ issues.add_assignee_at=`був призначений %s %s` issues.remove_assignee_at=`був знятий з призначення %s %s` issues.remove_self_assignment=`видалено призначення %s` issues.change_title_at=`змінився заголовок з %s на %s %s` -issues.tracker_plan_time = `Час план` -issues.change_plan_time_at=`змінив час план на %d годин %d хвилин %s` -issues.remove_plan_time = `видалив час план %s` +issues.tracker_plan_time = `Запланований час` +issues.change_plan_time_at=`змінив запланований час на %d годин %d хвилин %s` +issues.remove_plan_time = `видалив запланований час %s` issues.change_ref_at=`змінив посилання з %s на %s %s` issues.remove_ref_at=`видалив посилання %s %s` issues.add_ref_at=`додав посилання %s %s` From a8778f4db71cff969732c5614bf64cc48f7692a7 Mon Sep 17 00:00:00 2001 From: stuzer05 Date: Fri, 24 Feb 2023 12:15:43 +0200 Subject: [PATCH 04/59] Commit --- templates/repo/issue/view_content/comments.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/repo/issue/view_content/comments.tmpl b/templates/repo/issue/view_content/comments.tmpl index d7154b7863ed9..58816590b64d0 100644 --- a/templates/repo/issue/view_content/comments.tmpl +++ b/templates/repo/issue/view_content/comments.tmpl @@ -795,7 +795,7 @@
{{else if eq .Type 1001}}
- {{svg "octicon-pencil"}} + {{svg "octicon-clock"}} {{template "shared/user/avatarlink" Dict "Context" $.Context "user" .Poster}} {{template "shared/user/authorlink" .Poster}} From d9446629c3bac85a9e654f344e99a961771d249c Mon Sep 17 00:00:00 2001 From: stuzer05 Date: Fri, 24 Feb 2023 12:37:12 +0200 Subject: [PATCH 05/59] Commit --- templates/repo/issue/view_content/sidebar.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/repo/issue/view_content/sidebar.tmpl b/templates/repo/issue/view_content/sidebar.tmpl index abd5d48a3a28d..033c07187a207 100644 --- a/templates/repo/issue/view_content/sidebar.tmpl +++ b/templates/repo/issue/view_content/sidebar.tmpl @@ -368,7 +368,7 @@
- From 7ed86ff00a6daa3af6c7e129789fbd3393c5a36d Mon Sep 17 00:00:00 2001 From: stuzer05 Date: Fri, 24 Feb 2023 12:41:38 +0200 Subject: [PATCH 06/59] Commit --- routers/web/repo/issue.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go index 6a2807e534bc6..5a6d6f543bbb2 100644 --- a/routers/web/repo/issue.go +++ b/routers/web/repo/issue.go @@ -1985,14 +1985,20 @@ func UpdateIssuePlanTime(ctx *context.Context) { planTimeHours := ctx.FormInt("plan_time_hours") planTimeMinutes := ctx.FormInt("plan_time_minutes") + if issue.PlanTimeHours == planTimeHours && issue.PlanTimeMinutes == planTimeMinutes { + ctx.JSON(http.StatusOK, map[string]interface{}{ + "status": "ok", + }) + return + } + if err := issue_service.ChangePlanTime(issue, ctx.Doer, planTimeHours, planTimeMinutes); err != nil { ctx.ServerError("ChangePlanTime", err) return } ctx.JSON(http.StatusOK, map[string]interface{}{ - "plan_time_hours": issue.PlanTimeHours, - "plan_time_minutes": issue.PlanTimeMinutes, + "status": "ok", }) } From c248042c8eb47d98d124f76b13af7639b09efda1 Mon Sep 17 00:00:00 2001 From: stuzer05 Date: Fri, 24 Feb 2023 13:35:16 +0200 Subject: [PATCH 07/59] Commit --- options/locale/locale_ru-RU.ini | 3 --- options/locale/locale_uk-UA.ini | 3 --- 2 files changed, 6 deletions(-) diff --git a/options/locale/locale_ru-RU.ini b/options/locale/locale_ru-RU.ini index 425886f635319..f3efcf8c70f41 100644 --- a/options/locale/locale_ru-RU.ini +++ b/options/locale/locale_ru-RU.ini @@ -1216,9 +1216,6 @@ issues.add_assignee_at=`был(а) назначен(а) %s %s` issues.remove_assignee_at=`был снят с назначения %s %s` issues.remove_self_assignment=`убрал(а) их назначение %s` issues.change_title_at=`изменил(а) заголовок с %s на %s %s` -issues.tracker_plan_time = `Запланированное время` -issues.change_plan_time_at=`изменил(а) запланированное время на %d час(ов) %d минут %s` -issues.remove_plan_time = `убрал(а) запланированное время %s` issues.change_ref_at=`изменил(а) ссылку с %s на %s %s` issues.remove_ref_at=`убрал(а) ссылку %s %s` issues.add_ref_at=`добавил(а) ссылку %s %s` diff --git a/options/locale/locale_uk-UA.ini b/options/locale/locale_uk-UA.ini index 51b4f0a102b99..0c094cc636eb8 100644 --- a/options/locale/locale_uk-UA.ini +++ b/options/locale/locale_uk-UA.ini @@ -1160,9 +1160,6 @@ issues.add_assignee_at=`був призначений %s %s` issues.remove_assignee_at=`був знятий з призначення %s %s` issues.remove_self_assignment=`видалено призначення %s` issues.change_title_at=`змінився заголовок з %s на %s %s` -issues.tracker_plan_time = `Запланований час` -issues.change_plan_time_at=`змінив запланований час на %d годин %d хвилин %s` -issues.remove_plan_time = `видалив запланований час %s` issues.change_ref_at=`змінив посилання з %s на %s %s` issues.remove_ref_at=`видалив посилання %s %s` issues.add_ref_at=`додав посилання %s %s` From d75b7acac6742ade9ddda8522e0e148c5ea9e335 Mon Sep 17 00:00:00 2001 From: stuzer05 Date: Fri, 24 Feb 2023 13:36:53 +0200 Subject: [PATCH 08/59] Commit --- options/locale/locale_uk-UA.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/options/locale/locale_uk-UA.ini b/options/locale/locale_uk-UA.ini index 0c094cc636eb8..0b02a82ec23df 100644 --- a/options/locale/locale_uk-UA.ini +++ b/options/locale/locale_uk-UA.ini @@ -574,7 +574,7 @@ delete_email=Видалити email_deletion=Видалити адресу електронної пошти email_deletion_desc=Електронна адреса та пов'язана з нею інформація буде видалена з вашого облікового запису. Git коміти, здійснені через цю електронну адресу, залишиться без змін. Продовжити? email_deletion_success=Адресу електронної пошти було видалено. -theme_update_success=Тему оновлено. +theme_update_success=Тему оновлено. theme_update_error=Вибрана тема не існує. openid_deletion=Видалити адресу OpenID openid_deletion_desc=Видалення цієї OpenID-адреси з вашого облікового запису забороняє вам входити з ним. Продовжити? From 4be8c50a6fa357208a160b9125cf73b54cd5694d Mon Sep 17 00:00:00 2001 From: stuzer05 Date: Fri, 24 Feb 2023 13:38:05 +0200 Subject: [PATCH 09/59] Commit --- routers/web/repo/issue.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go index 5a6d6f543bbb2..7626a068599f9 100644 --- a/routers/web/repo/issue.go +++ b/routers/web/repo/issue.go @@ -1970,7 +1970,7 @@ func UpdateIssueTitle(ctx *context.Context) { }) } -// UpdateIssuePlanTime change issue's title +// UpdateIssuePlanTime change issue's planned time func UpdateIssuePlanTime(ctx *context.Context) { issue := GetActionIssue(ctx) if ctx.Written() { From 5f3edad64fe2a157bfe44f6a0b1b7a935de25152 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=B9=E3=83=84=E3=82=BC=E3=83=AB?= <23124682+stuzer05@users.noreply.github.com> Date: Fri, 24 Feb 2023 13:38:35 +0200 Subject: [PATCH 10/59] Update services/issue/issue.go Co-authored-by: Yarden Shoham --- services/issue/issue.go | 1 - 1 file changed, 1 deletion(-) diff --git a/services/issue/issue.go b/services/issue/issue.go index edddbecd1b97d..7fcf933c5e9e0 100644 --- a/services/issue/issue.go +++ b/services/issue/issue.go @@ -63,7 +63,6 @@ func ChangeTitle(issue *issues_model.Issue, doer *user_model.User, title string) // ChangeTitle changes the title of this issue, as the given user. func ChangePlanTime(issue *issues_model.Issue, doer *user_model.User, planTimeHours int, planTimeMinutes int) (err error) { - //oldTitle := issue.Title issue.PlanTimeHours = planTimeHours issue.PlanTimeMinutes = planTimeMinutes From f7a4c9e0aac0c99fafc2796a7b987e46ca669003 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=B9=E3=83=84=E3=82=BC=E3=83=AB?= <23124682+stuzer05@users.noreply.github.com> Date: Fri, 24 Feb 2023 13:39:32 +0200 Subject: [PATCH 11/59] Update services/issue/issue.go Co-authored-by: Yarden Shoham --- services/issue/issue.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/services/issue/issue.go b/services/issue/issue.go index 7fcf933c5e9e0..4a5a09e56579e 100644 --- a/services/issue/issue.go +++ b/services/issue/issue.go @@ -70,8 +70,6 @@ func ChangePlanTime(issue *issues_model.Issue, doer *user_model.User, planTimeHo return } - //notification.NotifyIssueChangeTitle(db.DefaultContext, doer, issue, oldTitle) - return nil } From e187364d7a9fddaf50b09ffa28985c293b13f7b0 Mon Sep 17 00:00:00 2001 From: stuzer05 Date: Fri, 24 Feb 2023 13:53:53 +0200 Subject: [PATCH 12/59] Commit --- models/issues/issue.go | 2 +- services/issue/issue.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/models/issues/issue.go b/models/issues/issue.go index 2061c4a99c976..c6f6c482f7921 100644 --- a/models/issues/issue.go +++ b/models/issues/issue.go @@ -779,7 +779,7 @@ func ChangeIssueTitle(issue *Issue, doer *user_model.User, oldTitle string) (err } // ChangeIssuePlanTime changes the plan time of this issue, as the given user. -func ChangeIssuePlanTime(issue *Issue, doer *user_model.User, planTimeHours int, planTimeMinutes int) (err error) { +func ChangeIssuePlanTime(issue *Issue, doer *user_model.User, planTimeHours, planTimeMinutes int) (err error) { ctx, committer, err := db.TxContext(db.DefaultContext) if err != nil { return err diff --git a/services/issue/issue.go b/services/issue/issue.go index 4a5a09e56579e..a909614f5d1ae 100644 --- a/services/issue/issue.go +++ b/services/issue/issue.go @@ -62,7 +62,7 @@ func ChangeTitle(issue *issues_model.Issue, doer *user_model.User, title string) } // ChangeTitle changes the title of this issue, as the given user. -func ChangePlanTime(issue *issues_model.Issue, doer *user_model.User, planTimeHours int, planTimeMinutes int) (err error) { +func ChangePlanTime(issue *issues_model.Issue, doer *user_model.User, planTimeHours, planTimeMinutes int) (err error) { issue.PlanTimeHours = planTimeHours issue.PlanTimeMinutes = planTimeMinutes From f33b0a0773838b57d3546dac68294d40ef9e925a Mon Sep 17 00:00:00 2001 From: stuzer05 Date: Fri, 24 Feb 2023 13:57:46 +0200 Subject: [PATCH 13/59] Commit --- options/locale/locale_en-US.ini | 2 +- templates/repo/issue/view_content/sidebar.tmpl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 94d1b896fec4f..588084c84e667 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1301,7 +1301,7 @@ issues.add_assignee_at = `was assigned by %s %s` issues.remove_assignee_at = `was unassigned by %s %s` issues.remove_self_assignment = `removed their assignment %s` issues.change_title_at = `changed title from %s to %s %s` -issues.tracker_plan_time = `Planned time` +issues.tracker_estimate = `Time Estimate` issues.change_plan_time_at = `changed planned time to %d hour %d minutes %s` issues.remove_plan_time = `removed planned time %s` issues.change_ref_at = `changed reference from %s to %s %s` diff --git a/templates/repo/issue/view_content/sidebar.tmpl b/templates/repo/issue/view_content/sidebar.tmpl index 033c07187a207..e56b3ff9a7c75 100644 --- a/templates/repo/issue/view_content/sidebar.tmpl +++ b/templates/repo/issue/view_content/sidebar.tmpl @@ -360,7 +360,7 @@ {{if and .CanUseTimetracker (not .Repository.IsArchived)}}
- {{.locale.Tr "repo.issues.tracker_plan_time"}} + {{.locale.Tr "repo.issues.tracker_estimate"}}
{{$.CsrfTokenHtml}} From 2fc2f63c6c3f7e166942935d88ff68956f2a7489 Mon Sep 17 00:00:00 2001 From: stuzer05 Date: Fri, 24 Feb 2023 14:02:36 +0200 Subject: [PATCH 14/59] Commit --- models/issues/comment.go | 2 +- models/issues/issue.go | 2 +- options/locale/locale_en-US.ini | 4 ++-- templates/repo/issue/view_content/comments.tmpl | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/models/issues/comment.go b/models/issues/comment.go index 015bb78f80785..87d07ce6d57b3 100644 --- a/models/issues/comment.go +++ b/models/issues/comment.go @@ -131,7 +131,7 @@ const ( // 35 pr was un scheduled to auto merge when checks succeed CommentTypePRUnScheduledToAutoMerge // 36 Change plan time - CommentTypeChangePlanTime + CommentTypeChangeTimeEstimate ) var commentStrings = []string{ diff --git a/models/issues/issue.go b/models/issues/issue.go index c6f6c482f7921..9e5c182514d5f 100644 --- a/models/issues/issue.go +++ b/models/issues/issue.go @@ -795,7 +795,7 @@ func ChangeIssuePlanTime(issue *Issue, doer *user_model.User, planTimeHours, pla } opts := &CreateCommentOptions{ - Type: CommentTypeChangePlanTime, + Type: CommentTypeChangeTimeEstimate, Doer: doer, Repo: issue.Repo, Issue: issue, diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 588084c84e667..591a0acf1f2ee 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1302,8 +1302,8 @@ issues.remove_assignee_at = `was unassigned by %s %s` issues.remove_self_assignment = `removed their assignment %s` issues.change_title_at = `changed title from %s to %s %s` issues.tracker_estimate = `Time Estimate` -issues.change_plan_time_at = `changed planned time to %d hour %d minutes %s` -issues.remove_plan_time = `removed planned time %s` +issues.change_time_estimate_at = `changed planned time to %d hour %d minutes %s` +issues.remove_time_estimate = `removed planned time %s` issues.change_ref_at = `changed reference from %s to %s %s` issues.remove_ref_at = `removed reference %s %s` issues.add_ref_at = `added reference %s %s` diff --git a/templates/repo/issue/view_content/comments.tmpl b/templates/repo/issue/view_content/comments.tmpl index 58816590b64d0..3a4f891963ef2 100644 --- a/templates/repo/issue/view_content/comments.tmpl +++ b/templates/repo/issue/view_content/comments.tmpl @@ -793,16 +793,16 @@ {{else}}{{$.locale.Tr "repo.pulls.auto_merge_canceled_schedule_comment" $createdStr | Safe}}{{end}}
- {{else if eq .Type 1001}} + {{else if eq .Type 36}}
{{svg "octicon-clock"}} {{template "shared/user/avatarlink" Dict "Context" $.Context "user" .Poster}} {{template "shared/user/authorlink" .Poster}} {{if and (eq .PlanTimeHours 0) (eq .PlanTimeMinutes 0)}} - {{$.locale.Tr "repo.issues.remove_plan_time" $createdStr | Safe}} + {{$.locale.Tr "repo.issues.remove_time_estimate" $createdStr | Safe}} {{else}} - {{$.locale.Tr "repo.issues.change_plan_time_at" (.PlanTimeHours) (.PlanTimeMinutes) $createdStr | Safe}} + {{$.locale.Tr "repo.issues.change_time_estimate_at" (.PlanTimeHours) (.PlanTimeMinutes) $createdStr | Safe}} {{end}}
From b062fc9849c2310409e66b5e9cf3ce9c2f72c03b Mon Sep 17 00:00:00 2001 From: stuzer05 Date: Fri, 24 Feb 2023 14:03:03 +0200 Subject: [PATCH 15/59] Commit --- options/locale/locale_en-US.ini | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 591a0acf1f2ee..fbf035610e0f0 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1302,8 +1302,8 @@ issues.remove_assignee_at = `was unassigned by %s %s` issues.remove_self_assignment = `removed their assignment %s` issues.change_title_at = `changed title from %s to %s %s` issues.tracker_estimate = `Time Estimate` -issues.change_time_estimate_at = `changed planned time to %d hour %d minutes %s` -issues.remove_time_estimate = `removed planned time %s` +issues.change_time_estimate_at = `changed time estimate to %d hour %d minutes %s` +issues.remove_time_estimate = `removed time estimate %s` issues.change_ref_at = `changed reference from %s to %s %s` issues.remove_ref_at = `removed reference %s %s` issues.add_ref_at = `added reference %s %s` From 870bb922cc707c079350aee0ce2383673544b200 Mon Sep 17 00:00:00 2001 From: stuzer05 Date: Fri, 24 Feb 2023 14:05:26 +0200 Subject: [PATCH 16/59] Commit --- models/issues/comment.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/issues/comment.go b/models/issues/comment.go index 87d07ce6d57b3..94021fb6675ba 100644 --- a/models/issues/comment.go +++ b/models/issues/comment.go @@ -130,7 +130,7 @@ const ( CommentTypePRScheduledToAutoMerge // 35 pr was un scheduled to auto merge when checks succeed CommentTypePRUnScheduledToAutoMerge - // 36 Change plan time + // 36 Change time estimate CommentTypeChangeTimeEstimate ) From d247b0ffd1774a8d917fb3c227f1f72f28d95e67 Mon Sep 17 00:00:00 2001 From: stuzer05 Date: Fri, 24 Feb 2023 14:08:38 +0200 Subject: [PATCH 17/59] Commit --- models/issues/comment.go | 134 +++++++++--------- models/issues/issue.go | 22 +-- modules/structs/issue.go | 38 ++--- options/locale/locale_en-US.ini | 2 +- routers/web/repo/issue.go | 4 +- services/issue/issue.go | 6 +- .../repo/issue/view_content/comments.tmpl | 4 +- .../repo/issue/view_content/sidebar.tmpl | 6 +- web_src/js/features/repo-issue.js | 4 +- 9 files changed, 110 insertions(+), 110 deletions(-) diff --git a/models/issues/comment.go b/models/issues/comment.go index 94021fb6675ba..6e0095084881d 100644 --- a/models/issues/comment.go +++ b/models/issues/comment.go @@ -146,7 +146,7 @@ var commentStrings = []string{ "milestone", "assignees", "change_title", - "change_plan_time", + "change_time_estimate", "delete_branch", "start_tracking", "stop_tracking", @@ -305,8 +305,8 @@ type Comment struct { CommitsNum int64 `xorm:"-"` IsForcePush bool `xorm:"-"` - PlanTimeHours int - PlanTimeMinutes int + TimeEstimateHours int + TimeEstimateMinutes int } func init() { @@ -793,40 +793,40 @@ func CreateComment(ctx context.Context, opts *CreateCommentOptions) (_ *Comment, } comment := &Comment{ - Type: opts.Type, - PosterID: opts.Doer.ID, - Poster: opts.Doer, - IssueID: opts.Issue.ID, - LabelID: LabelID, - OldMilestoneID: opts.OldMilestoneID, - MilestoneID: opts.MilestoneID, - OldProjectID: opts.OldProjectID, - ProjectID: opts.ProjectID, - TimeID: opts.TimeID, - RemovedAssignee: opts.RemovedAssignee, - AssigneeID: opts.AssigneeID, - AssigneeTeamID: opts.AssigneeTeamID, - CommitID: opts.CommitID, - CommitSHA: opts.CommitSHA, - Line: opts.LineNum, - Content: opts.Content, - OldTitle: opts.OldTitle, - NewTitle: opts.NewTitle, - OldRef: opts.OldRef, - NewRef: opts.NewRef, - DependentIssueID: opts.DependentIssueID, - TreePath: opts.TreePath, - ReviewID: opts.ReviewID, - Patch: opts.Patch, - RefRepoID: opts.RefRepoID, - RefIssueID: opts.RefIssueID, - RefCommentID: opts.RefCommentID, - RefAction: opts.RefAction, - RefIsPull: opts.RefIsPull, - IsForcePush: opts.IsForcePush, - Invalidated: opts.Invalidated, - PlanTimeHours: opts.PlanTimeHours, - PlanTimeMinutes: opts.PlanTimeMinutes, + Type: opts.Type, + PosterID: opts.Doer.ID, + Poster: opts.Doer, + IssueID: opts.Issue.ID, + LabelID: LabelID, + OldMilestoneID: opts.OldMilestoneID, + MilestoneID: opts.MilestoneID, + OldProjectID: opts.OldProjectID, + ProjectID: opts.ProjectID, + TimeID: opts.TimeID, + RemovedAssignee: opts.RemovedAssignee, + AssigneeID: opts.AssigneeID, + AssigneeTeamID: opts.AssigneeTeamID, + CommitID: opts.CommitID, + CommitSHA: opts.CommitSHA, + Line: opts.LineNum, + Content: opts.Content, + OldTitle: opts.OldTitle, + NewTitle: opts.NewTitle, + OldRef: opts.OldRef, + NewRef: opts.NewRef, + DependentIssueID: opts.DependentIssueID, + TreePath: opts.TreePath, + ReviewID: opts.ReviewID, + Patch: opts.Patch, + RefRepoID: opts.RefRepoID, + RefIssueID: opts.RefIssueID, + RefCommentID: opts.RefCommentID, + RefAction: opts.RefAction, + RefIsPull: opts.RefIsPull, + IsForcePush: opts.IsForcePush, + Invalidated: opts.Invalidated, + TimeEstimateHours: opts.TimeEstimateHours, + TimeEstimateMinutes: opts.TimeEstimateMinutes, } if _, err = e.Insert(comment); err != nil { return nil, err @@ -970,36 +970,36 @@ type CreateCommentOptions struct { Issue *Issue Label *Label - DependentIssueID int64 - OldMilestoneID int64 - MilestoneID int64 - OldProjectID int64 - ProjectID int64 - TimeID int64 - AssigneeID int64 - AssigneeTeamID int64 - RemovedAssignee bool - OldTitle string - NewTitle string - OldRef string - NewRef string - CommitID int64 - CommitSHA string - Patch string - LineNum int64 - TreePath string - ReviewID int64 - Content string - Attachments []string // UUIDs of attachments - RefRepoID int64 - RefIssueID int64 - RefCommentID int64 - RefAction references.XRefAction - RefIsPull bool - IsForcePush bool - Invalidated bool - PlanTimeHours int - PlanTimeMinutes int + DependentIssueID int64 + OldMilestoneID int64 + MilestoneID int64 + OldProjectID int64 + ProjectID int64 + TimeID int64 + AssigneeID int64 + AssigneeTeamID int64 + RemovedAssignee bool + OldTitle string + NewTitle string + OldRef string + NewRef string + CommitID int64 + CommitSHA string + Patch string + LineNum int64 + TreePath string + ReviewID int64 + Content string + Attachments []string // UUIDs of attachments + RefRepoID int64 + RefIssueID int64 + RefCommentID int64 + RefAction references.XRefAction + RefIsPull bool + IsForcePush bool + Invalidated bool + TimeEstimateHours int + TimeEstimateMinutes int } // GetCommentByID returns the comment by given ID. diff --git a/models/issues/issue.go b/models/issues/issue.go index 9e5c182514d5f..1c7100507c21b 100644 --- a/models/issues/issue.go +++ b/models/issues/issue.go @@ -148,8 +148,8 @@ type Issue struct { ShowRole RoleDescriptor `xorm:"-"` // Plan time - PlanTimeHours int - PlanTimeMinutes int + TimeEstimateHours int + TimeEstimateMinutes int } var ( @@ -778,15 +778,15 @@ func ChangeIssueTitle(issue *Issue, doer *user_model.User, oldTitle string) (err return committer.Commit() } -// ChangeIssuePlanTime changes the plan time of this issue, as the given user. -func ChangeIssuePlanTime(issue *Issue, doer *user_model.User, planTimeHours, planTimeMinutes int) (err error) { +// ChangeIssueTimeEstimate changes the plan time of this issue, as the given user. +func ChangeIssueTimeEstimate(issue *Issue, doer *user_model.User, planTimeHours, planTimeMinutes int) (err error) { ctx, committer, err := db.TxContext(db.DefaultContext) if err != nil { return err } defer committer.Close() - if err = UpdateIssueCols(ctx, &Issue{ID: issue.ID, PlanTimeHours: planTimeHours, PlanTimeMinutes: planTimeMinutes}, "plan_time_hours", "plan_time_minutes"); err != nil { + if err = UpdateIssueCols(ctx, &Issue{ID: issue.ID, TimeEstimateHours: planTimeHours, TimeEstimateMinutes: planTimeMinutes}, "time_estimate_hours", "plan_time_minutes"); err != nil { return fmt.Errorf("updateIssueCols: %w", err) } @@ -795,12 +795,12 @@ func ChangeIssuePlanTime(issue *Issue, doer *user_model.User, planTimeHours, pla } opts := &CreateCommentOptions{ - Type: CommentTypeChangeTimeEstimate, - Doer: doer, - Repo: issue.Repo, - Issue: issue, - PlanTimeHours: planTimeHours, - PlanTimeMinutes: planTimeMinutes, + Type: CommentTypeChangeTimeEstimate, + Doer: doer, + Repo: issue.Repo, + Issue: issue, + TimeEstimateHours: planTimeHours, + TimeEstimateMinutes: planTimeMinutes, } if _, err = CreateComment(ctx, opts); err != nil { return fmt.Errorf("createComment: %w", err) diff --git a/modules/structs/issue.go b/modules/structs/issue.go index bf6bbe13b8099..27036d76edc88 100644 --- a/modules/structs/issue.go +++ b/modules/structs/issue.go @@ -41,21 +41,21 @@ type RepositoryMeta struct { // Issue represents an issue in a repository // swagger:model type Issue struct { - ID int64 `json:"id"` - URL string `json:"url"` - HTMLURL string `json:"html_url"` - Index int64 `json:"number"` - Poster *User `json:"user"` - OriginalAuthor string `json:"original_author"` - OriginalAuthorID int64 `json:"original_author_id"` - Title string `json:"title"` - Body string `json:"body"` - Ref string `json:"ref"` - Attachments []*Attachment `json:"assets"` - Labels []*Label `json:"labels"` - Milestone *Milestone `json:"milestone"` - PlanTimeHours int64 `json:"plan_time_hours"` - PlanTimeMinutes int64 `json:"plan_time_minutes"` + ID int64 `json:"id"` + URL string `json:"url"` + HTMLURL string `json:"html_url"` + Index int64 `json:"number"` + Poster *User `json:"user"` + OriginalAuthor string `json:"original_author"` + OriginalAuthorID int64 `json:"original_author_id"` + Title string `json:"title"` + Body string `json:"body"` + Ref string `json:"ref"` + Attachments []*Attachment `json:"assets"` + Labels []*Label `json:"labels"` + Milestone *Milestone `json:"milestone"` + TimeEstimateHours int64 `json:"time_estimate_hours"` + TimeEstimateMinutes int64 `json:"plan_time_minutes"` // deprecated Assignee *User `json:"assignee"` Assignees []*User `json:"assignees"` @@ -108,10 +108,10 @@ type EditIssueOption struct { Milestone *int64 `json:"milestone"` State *string `json:"state"` // swagger:strfmt date-time - Deadline *time.Time `json:"due_date"` - PlanTimeHours int `json:"plan_time_hours"` - PlanTimeMinutes int `json:"plan_time_minutes"` - RemoveDeadline *bool `json:"unset_due_date"` + Deadline *time.Time `json:"due_date"` + TimeEstimateHours int `json:"time_estimate_hours"` + TimeEstimateMinutes int `json:"plan_time_minutes"` + RemoveDeadline *bool `json:"unset_due_date"` } // EditDeadlineOption options for creating a deadline diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index fbf035610e0f0..19de8a1a7d8bf 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1301,7 +1301,7 @@ issues.add_assignee_at = `was assigned by %s %s` issues.remove_assignee_at = `was unassigned by %s %s` issues.remove_self_assignment = `removed their assignment %s` issues.change_title_at = `changed title from %s to %s %s` -issues.tracker_estimate = `Time Estimate` +issues.tracker_time_estimate = `Time Estimate` issues.change_time_estimate_at = `changed time estimate to %d hour %d minutes %s` issues.remove_time_estimate = `removed time estimate %s` issues.change_ref_at = `changed reference from %s to %s %s` diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go index 7626a068599f9..bfb16a6455f60 100644 --- a/routers/web/repo/issue.go +++ b/routers/web/repo/issue.go @@ -1982,10 +1982,10 @@ func UpdateIssuePlanTime(ctx *context.Context) { return } - planTimeHours := ctx.FormInt("plan_time_hours") + planTimeHours := ctx.FormInt("time_estimate_hours") planTimeMinutes := ctx.FormInt("plan_time_minutes") - if issue.PlanTimeHours == planTimeHours && issue.PlanTimeMinutes == planTimeMinutes { + if issue.TimeEstimateHours == planTimeHours && issue.TimeEstimateMinutes == planTimeMinutes { ctx.JSON(http.StatusOK, map[string]interface{}{ "status": "ok", }) diff --git a/services/issue/issue.go b/services/issue/issue.go index a909614f5d1ae..23e472384b204 100644 --- a/services/issue/issue.go +++ b/services/issue/issue.go @@ -63,10 +63,10 @@ func ChangeTitle(issue *issues_model.Issue, doer *user_model.User, title string) // ChangeTitle changes the title of this issue, as the given user. func ChangePlanTime(issue *issues_model.Issue, doer *user_model.User, planTimeHours, planTimeMinutes int) (err error) { - issue.PlanTimeHours = planTimeHours - issue.PlanTimeMinutes = planTimeMinutes + issue.TimeEstimateHours = planTimeHours + issue.TimeEstimateMinutes = planTimeMinutes - if err = issues_model.ChangeIssuePlanTime(issue, doer, planTimeHours, planTimeMinutes); err != nil { + if err = issues_model.ChangeIssueTimeEstimate(issue, doer, planTimeHours, planTimeMinutes); err != nil { return } diff --git a/templates/repo/issue/view_content/comments.tmpl b/templates/repo/issue/view_content/comments.tmpl index 3a4f891963ef2..fe9446bcd5431 100644 --- a/templates/repo/issue/view_content/comments.tmpl +++ b/templates/repo/issue/view_content/comments.tmpl @@ -799,10 +799,10 @@ {{template "shared/user/avatarlink" Dict "Context" $.Context "user" .Poster}} {{template "shared/user/authorlink" .Poster}} - {{if and (eq .PlanTimeHours 0) (eq .PlanTimeMinutes 0)}} + {{if and (eq .TimeEstimateHours 0) (eq .TimeEstimateMinutes 0)}} {{$.locale.Tr "repo.issues.remove_time_estimate" $createdStr | Safe}} {{else}} - {{$.locale.Tr "repo.issues.change_time_estimate_at" (.PlanTimeHours) (.PlanTimeMinutes) $createdStr | Safe}} + {{$.locale.Tr "repo.issues.change_time_estimate_at" (.TimeEstimateHours) (.TimeEstimateMinutes) $createdStr | Safe}} {{end}} diff --git a/templates/repo/issue/view_content/sidebar.tmpl b/templates/repo/issue/view_content/sidebar.tmpl index e56b3ff9a7c75..a0482b62a9828 100644 --- a/templates/repo/issue/view_content/sidebar.tmpl +++ b/templates/repo/issue/view_content/sidebar.tmpl @@ -360,13 +360,13 @@ {{if and .CanUseTimetracker (not .Repository.IsArchived)}}
- {{.locale.Tr "repo.issues.tracker_estimate"}} + {{.locale.Tr "repo.issues.tracker_time_estimate"}} {{$.CsrfTokenHtml}}
- - + +
{{else if eq .Type 27}} @@ -802,8 +802,7 @@ {{if and (eq .TimeEstimate 0)}} {{$.locale.Tr "repo.issues.remove_time_estimate" $createdStr | Safe}} {{else}} - {{$timeStr := .TimeEstimateToStrTranslated $.locale}} - {{$.locale.Tr "repo.issues.change_time_estimate_at" $timeStr $createdStr | Safe}} + {{$.locale.Tr "repo.issues.change_time_estimate_at" (SecToTimeExact .TimeEstimate) $createdStr | Safe}} {{end}} diff --git a/templates/repo/issue/view_content/sidebar.tmpl b/templates/repo/issue/view_content/sidebar.tmpl index 14e6b09b89b16..17003bce65225 100644 --- a/templates/repo/issue/view_content/sidebar.tmpl +++ b/templates/repo/issue/view_content/sidebar.tmpl @@ -413,8 +413,9 @@ {{if gt (len .WorkingUsers) 0}}
- {{.locale.Tr "repo.issues.time_spent_from_all_authors" ($.Issue.TotalTrackedTime | Sec2Time) | Safe}} -
+
{{.locale.Tr "repo.issues.time_spent_from_all_authors" | Safe}}
+
{{SecToTimeExact .Issue.TotalTrackedTime}}
+
{{range $user, $trackedtime := .WorkingUsers}}
From e15549501d7b1cf2e0976199e1911e44248c9787 Mon Sep 17 00:00:00 2001 From: stuzer05 Date: Fri, 24 Feb 2023 19:29:51 +0200 Subject: [PATCH 24/59] Commit --- models/issues/issue.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/models/issues/issue.go b/models/issues/issue.go index 6ec042000f1a4..316e3f5f33b1a 100644 --- a/models/issues/issue.go +++ b/models/issues/issue.go @@ -2479,10 +2479,10 @@ func (issue *Issue) TimeEstimateFromStr(timeStr string) int64 { timeTotal := 0 // Time match regex - rWeeks, _ := regexp.Compile("([\\d]+)w") - rDays, _ := regexp.Compile("([\\d]+)d") - rHours, _ := regexp.Compile("([\\d]+)h") - rMinutes, _ := regexp.Compile("([\\d]+)m") + rWeeks := regexp.MustCompile(`([\d]+)w`) + rDays := regexp.MustCompile(`([\d]+)d`) + rHours := regexp.MustCompile(`([\d]+)h`) + rMinutes := regexp.MustCompile(`([\d]+)m`) // Find time weeks timeStrMatches := rWeeks.FindStringSubmatch(timeStr) @@ -2547,7 +2547,6 @@ func (issue *Issue) TimeEstimateToStr() string { if minutes > 0 { timeParts = append(timeParts, fmt.Sprintf("%dm", int64(minutes))) } - timeSeconds -= minutes * (60) - return strings.Join(timeParts[:], " ") + return strings.Join(timeParts, " ") } From f463765fec8d427b947069d8343d31c206460ba3 Mon Sep 17 00:00:00 2001 From: stuzer05 Date: Fri, 24 Feb 2023 19:31:40 +0200 Subject: [PATCH 25/59] Commit --- templates/swagger/v1_json.tmpl | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/templates/swagger/v1_json.tmpl b/templates/swagger/v1_json.tmpl index de774deaed13a..f1524dee5dc8c 100644 --- a/templates/swagger/v1_json.tmpl +++ b/templates/swagger/v1_json.tmpl @@ -16287,6 +16287,10 @@ "type": "string", "x-go-name": "State" }, + "time_estimate": { + "type": "string", + "x-go-name": "TimeEstimate" + }, "title": { "type": "string", "x-go-name": "Title" @@ -17505,6 +17509,11 @@ "state": { "$ref": "#/definitions/StateType" }, + "time_estimate": { + "type": "integer", + "format": "int64", + "x-go-name": "TimeEstimate" + }, "title": { "type": "string", "x-go-name": "Title" From 7a570440f172f942b770e3bd405bfbfe22be4d5b Mon Sep 17 00:00:00 2001 From: stuzer05 Date: Fri, 24 Feb 2023 19:44:24 +0200 Subject: [PATCH 26/59] Commit --- models/issues/tracked_time.go | 2 +- modules/util/sec_to_time.go | 6 ++++-- templates/repo/issue/view_content/comments.tmpl | 8 ++++---- templates/repo/issue/view_content/sidebar.tmpl | 4 ++-- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/models/issues/tracked_time.go b/models/issues/tracked_time.go index 1f8234b29b0cd..703ce174c00af 100644 --- a/models/issues/tracked_time.go +++ b/models/issues/tracked_time.go @@ -221,7 +221,7 @@ func TotalTimes(options *FindTrackedTimesOptions) (map[*user_model.User]string, } return nil, err } - totalTimes[user] = util.SecToTimeExact(total) + totalTimes[user] = util.SecToTimeExact(total, false) } return totalTimes, nil } diff --git a/modules/util/sec_to_time.go b/modules/util/sec_to_time.go index 290e56754c0b3..79a87157e2112 100644 --- a/modules/util/sec_to_time.go +++ b/modules/util/sec_to_time.go @@ -64,7 +64,7 @@ func SecToTime(duration int64) string { return strings.TrimRight(formattedTime, " ") } -func SecToTimeExact(duration int64) string { +func SecToTimeExact(duration int64, withSeconds bool) string { formattedTime := "" // The following four variables are calculated by taking @@ -93,7 +93,9 @@ func SecToTimeExact(duration int64) string { formattedTime = formatTime(days, "day", formattedTime) formattedTime = formatTime(hours, "hour", formattedTime) formattedTime = formatTime(minutes, "minute", formattedTime) - formattedTime = formatTime(seconds, "second", formattedTime) + if withSeconds { + formattedTime = formatTime(seconds, "second", formattedTime) + } // The formatTime() function always appends a space at the end. This will be trimmed return strings.TrimRight(formattedTime, " ") diff --git a/templates/repo/issue/view_content/comments.tmpl b/templates/repo/issue/view_content/comments.tmpl index 5a97c565679be..89ba5b5768708 100644 --- a/templates/repo/issue/view_content/comments.tmpl +++ b/templates/repo/issue/view_content/comments.tmpl @@ -263,7 +263,7 @@ {{template "repo/issue/view_content/comments_delete_time" Dict "ctx" $ "comment" .}}
{{svg "octicon-clock"}} - {{SecToTimeExact .TimeTracked}} + {{SecToTimeExact .TimeTracked false}}
{{else if eq .Type 14}} @@ -277,7 +277,7 @@ {{template "repo/issue/view_content/comments_delete_time" Dict "ctx" $ "comment" .}}
{{svg "octicon-clock"}} - {{SecToTimeExact .TimeTracked}} + {{SecToTimeExact .TimeTracked false}}
{{else if eq .Type 15}} @@ -668,7 +668,7 @@
{{svg "octicon-clock"}} - - {{SecToTimeExact .TimeTracked}} + - {{SecToTimeExact .TimeTracked false}}
{{else if eq .Type 27}} @@ -802,7 +802,7 @@ {{if and (eq .TimeEstimate 0)}} {{$.locale.Tr "repo.issues.remove_time_estimate" $createdStr | Safe}} {{else}} - {{$.locale.Tr "repo.issues.change_time_estimate_at" (SecToTimeExact .TimeEstimate) $createdStr | Safe}} + {{$.locale.Tr "repo.issues.change_time_estimate_at" (SecToTimeExact .TimeEstimate false) $createdStr | Safe}} {{end}}
diff --git a/templates/repo/issue/view_content/sidebar.tmpl b/templates/repo/issue/view_content/sidebar.tmpl index 17003bce65225..4e40e9b7b0a09 100644 --- a/templates/repo/issue/view_content/sidebar.tmpl +++ b/templates/repo/issue/view_content/sidebar.tmpl @@ -365,7 +365,7 @@
{{$.CsrfTokenHtml}}
- +