refactor(issue): share the prompt policy check of issue forms

issue create, issue edit and comment prompts ask canPrompt, like the
milestone and label forms, instead of loading the settings themselves.

Signed-off-by: bircni <bircni@icloud.com>
This commit is contained in:
bircni committed 2026-10-12 00:17:08 +02:00
1 parent 01ced23a4a
commit 511252e2a5
3 files changed
+10 -12

No files matched your search

+2 -2
View File
@@ -32,12 +32,12 @@ $ tea issue edit 12 --body-file notes.md`, Annotations: map[string]string{"tea.a
if err := validateBodySources(cmd); err != nil {
return err
}
snapshot, err := a.deps.Settings.Load()
prompt, err := a.canPrompt()
if err != nil {
return err
}
if !localFlagsChanged(cmd) {
if !a.policy(snapshot).CanPrompt(a.deps.Streams) || a.deps.IssueEditForm == nil {
if !prompt || a.deps.IssueEditForm == nil {
return errNothingToEdit
}
target, numbers, err := a.resolveRefs(cmd, args, issueRef)