mirror of
https://gitea.com/gitea/tea.git
synced 2026-10-26 11:01:25 +01:00
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:
3 files changed
+10
-12
No files matched your search
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user