From 90a9d91dca49d86d3b059baf7b94697c4a0f5abb Mon Sep 17 00:00:00 2001 From: mitchell Date: Mon, 21 Aug 2023 18:17:16 -0400 Subject: [PATCH 1/2] Added team notice when renaming or moving a project. --- internal/locale/locales/en-us.yaml | 8 ++++++++ internal/runners/projects/edit.go | 5 +++++ internal/runners/projects/move.go | 7 ++++--- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/internal/locale/locales/en-us.yaml b/internal/locale/locales/en-us.yaml index d8eaf72ae9..5191b27bda 100644 --- a/internal/locale/locales/en-us.yaml +++ b/internal/locale/locales/en-us.yaml @@ -2078,6 +2078,14 @@ err_country_blocked: other: This service is not available in your region. err_shortcutdir_writable: other: Could not continue as we don't have permission to create [ACTIONABLE]{{.V0}}[/RESET]. +move_prompt: + other: | + You are about to move the project [NOTICE]{{.V0}}[/RESET] to the organization [NOTICE]{{.V1}}[/RESET]. + This action will invalidate any local checkouts that already exist for this project. If you or your team members have checked out this project anywhere else, please update them with the new namespace: [ACTIONABLE]{{.V1}}/{{.V2}}[/RESET]. + Continue? +edit_prompt_name_notice: + other: | + Renaming a project will invalidate any local checkouts that already exist for this project. If you or your team members have checked out this project anywhere else, please update them with the new namespace: [ACTIONABLE]{{.V0}}/{{.V1}}[/RESET]. err_edit_local_checkouts: other: Could not update local checkouts err_edit_project_mapping: diff --git a/internal/runners/projects/edit.go b/internal/runners/projects/edit.go index d2b0c71a5f..67855092af 100644 --- a/internal/runners/projects/edit.go +++ b/internal/runners/projects/edit.go @@ -83,6 +83,11 @@ func (e *Edit) Run(params *EditParams) error { editMsg += locale.Tl("edit_prompt_repo", " - Repository: {{.V0}}\n", params.Repository) editable.RepoURL = ¶ms.Repository } + + if params.ProjectName != "" { + editMsg += locale.Tl("edit_prompt_name_notice", "", params.Namespace.Owner, params.ProjectName) + } + editMsg += locale.Tl("edit_prompt_confirm", "Continue?") defaultChoice := !e.out.Config().Interactive diff --git a/internal/runners/projects/move.go b/internal/runners/projects/move.go index 56607e618e..0a065fe4c5 100644 --- a/internal/runners/projects/move.go +++ b/internal/runners/projects/move.go @@ -42,9 +42,10 @@ func (m *Move) Run(params *MoveParams) error { } defaultChoice := !m.out.Config().Interactive - move, err := m.prompt.Confirm("", locale.Tl("move_prompt", - "You are about to move the project [NOTICE]{{.V0}}[/RESET] to the organization [NOTICE]{{.V1}}[/RESET].\nContinue?", - params.Namespace.String(), params.NewOwner), &defaultChoice) + move, err := m.prompt.Confirm("", locale.Tl("move_prompt", "", + params.Namespace.String(), + params.NewOwner, + params.Namespace.Project), &defaultChoice) if err != nil { return locale.WrapError(err, "err_move_prompt", "Could not prompt for move confirmation") } From 13328c8589cfc5219185e826443b14f70112d694 Mon Sep 17 00:00:00 2001 From: mitchell Date: Tue, 22 Aug 2023 13:15:07 -0400 Subject: [PATCH 2/2] Prefer locale.Tr(). --- internal/runners/projects/edit.go | 2 +- internal/runners/projects/move.go | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/internal/runners/projects/edit.go b/internal/runners/projects/edit.go index 67855092af..635dc821bb 100644 --- a/internal/runners/projects/edit.go +++ b/internal/runners/projects/edit.go @@ -85,7 +85,7 @@ func (e *Edit) Run(params *EditParams) error { } if params.ProjectName != "" { - editMsg += locale.Tl("edit_prompt_name_notice", "", params.Namespace.Owner, params.ProjectName) + editMsg += locale.Tr("edit_prompt_name_notice", params.Namespace.Owner, params.ProjectName) } editMsg += locale.Tl("edit_prompt_confirm", "Continue?") diff --git a/internal/runners/projects/move.go b/internal/runners/projects/move.go index 0a065fe4c5..c3d4b40c31 100644 --- a/internal/runners/projects/move.go +++ b/internal/runners/projects/move.go @@ -42,10 +42,7 @@ func (m *Move) Run(params *MoveParams) error { } defaultChoice := !m.out.Config().Interactive - move, err := m.prompt.Confirm("", locale.Tl("move_prompt", "", - params.Namespace.String(), - params.NewOwner, - params.Namespace.Project), &defaultChoice) + move, err := m.prompt.Confirm("", locale.Tr("move_prompt", params.Namespace.String(), params.NewOwner, params.Namespace.Project), &defaultChoice) if err != nil { return locale.WrapError(err, "err_move_prompt", "Could not prompt for move confirmation") }