mirror of
https://gitea.com/gitea/tea.git
synced 2026-10-26 11:01:25 +01:00
fix(pr): review decision ignores comment reviews, paged review list, pending review comments hidden, team request names (follow gh)
Signed-off-by: bircni <bircni@icloud.com>
This commit is contained in:
19 files changed
+258
-50
No files matched your search
@@ -123,7 +123,7 @@ func (a *application) pendingReview(cmd *cobra.Command, service services.Reviews
|
||||
}
|
||||
|
||||
func (a *application) pullReviewDeleteCommand() *cobra.Command {
|
||||
cmd := &cobra.Command{Use: "delete <number> <review-id>", Short: "Delete a review", Annotations: pullArgumentsAnnotation(textOutput("review deletion does not return a resource")), Args: argsExact(2), RunE: func(cmd *cobra.Command, args []string) error {
|
||||
cmd := &cobra.Command{Use: "delete <number> <review-id>", Short: "Delete a review", Annotations: pullArgumentRequiredAnnotation(textOutput("review deletion does not return a resource")), Args: argsExact(2), RunE: func(cmd *cobra.Command, args []string) error {
|
||||
t, n, id, err := a.pullAndID(cmd, args)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -133,7 +133,7 @@ func (a *application) pullReviewDeleteCommand() *cobra.Command {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
subject := fmt.Sprintf("review %d by %s on %s#%d", id, item.Author, t.Repo, n)
|
||||
subject := fmt.Sprintf("review %d by %s on %s#%d", id, item.Reviewer(), t.Repo, n)
|
||||
return a.deleteConfirmed(cmd, subject, func() error { return service.Delete(cmd.Context(), n, id) })
|
||||
}}
|
||||
cmd.Annotations["tea.confirm"] = "true"
|
||||
@@ -149,7 +149,7 @@ func (a *application) pullReviewDismissCommand(dismiss bool) *cobra.Command {
|
||||
if dismiss {
|
||||
use, short = "dismiss <number> <review-id>", "Dismiss an approval or change request"
|
||||
}
|
||||
cmd := &cobra.Command{Use: use, Short: short, Annotations: pullArgumentsAnnotation(nil), Args: argsExact(2), RunE: func(cmd *cobra.Command, args []string) (runErr error) {
|
||||
cmd := &cobra.Command{Use: use, Short: short, Annotations: pullArgumentRequiredAnnotation(nil), Args: argsExact(2), RunE: func(cmd *cobra.Command, args []string) (runErr error) {
|
||||
var draft terminal.Draft
|
||||
defer finishDraft(&draft, &runErr)
|
||||
var err error
|
||||
@@ -183,6 +183,14 @@ func (a *application) pullReviewDismissCommand(dismiss bool) *cobra.Command {
|
||||
return err
|
||||
}
|
||||
subject := fmt.Sprintf("%s on %s#%d", reviewPossessive(current), t.Repo, n)
|
||||
switch {
|
||||
case dismiss && current.State != "APPROVED" && current.State != "REQUEST_CHANGES":
|
||||
// Gitea refuses other review types with a misleading "permission denied".
|
||||
return clierr.Wrap(clierr.Usage, fmt.Errorf("only approvals and change requests can be dismissed; %s is not one", subject))
|
||||
case !dismiss && !current.Dismissed:
|
||||
a.warn(cmd, "%s is not dismissed", subject)
|
||||
return a.jsonResult(cmd, current)
|
||||
}
|
||||
if dismiss {
|
||||
if err := a.confirmAction(cmd, terminal.Confirmation{Prompt: "Dismiss " + subject + "?"}); err != nil {
|
||||
return err
|
||||
|
||||
Reference in new issue
Block a user