From 73e3a1cd02c5d2bdaf03d5998ae12bc86de2fa75 Mon Sep 17 00:00:00 2001 From: Robert Schilling Date: Wed, 20 Feb 2019 14:20:58 +0100 Subject: Add API support for filtering confidential issues --- lib/api/issues.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'lib') diff --git a/lib/api/issues.rb b/lib/api/issues.rb index 94ed9ac6fb1..3862c29d841 100644 --- a/lib/api/issues.rb +++ b/lib/api/issues.rb @@ -15,6 +15,14 @@ module API params :issue_params_ee do end + + def convert_confidential_param(args) + confidential = args.delete(:confidential) + return args if confidential.nil? + + args[:confidential] = confidential ? 'yes' : 'no' + args + end end helpers do @@ -26,6 +34,7 @@ module API args[:milestone_title] = args.delete(:milestone) args[:label_name] = args.delete(:labels) args[:scope] = args[:scope].underscore if args[:scope] + args = convert_confidential_param(args) issues = IssuesFinder.new(current_user, args).execute .preload(:assignees, :labels, :notes, :timelogs, :project, :author, :closed_by) @@ -54,6 +63,7 @@ module API optional :scope, type: String, values: %w[created-by-me assigned-to-me created_by_me assigned_to_me all], desc: 'Return issues for the given scope: `created_by_me`, `assigned_to_me` or `all`' optional :my_reaction_emoji, type: String, desc: 'Return issues reacted by the authenticated user by the given emoji' + optional :confidential, type: Boolean, desc: 'Filter confidential or public issues' use :pagination use :issues_params_ee -- cgit v1.2.3 From bf7846bec07157a8023770d03854834cceb69e3d Mon Sep 17 00:00:00 2001 From: Robert Schilling Date: Fri, 22 Feb 2019 10:19:25 +0100 Subject: Only use boolean parameters internally Use internally only boolean params. --- lib/api/issues.rb | 9 --------- 1 file changed, 9 deletions(-) (limited to 'lib') diff --git a/lib/api/issues.rb b/lib/api/issues.rb index 3862c29d841..f43f4d961d6 100644 --- a/lib/api/issues.rb +++ b/lib/api/issues.rb @@ -15,14 +15,6 @@ module API params :issue_params_ee do end - - def convert_confidential_param(args) - confidential = args.delete(:confidential) - return args if confidential.nil? - - args[:confidential] = confidential ? 'yes' : 'no' - args - end end helpers do @@ -34,7 +26,6 @@ module API args[:milestone_title] = args.delete(:milestone) args[:label_name] = args.delete(:labels) args[:scope] = args[:scope].underscore if args[:scope] - args = convert_confidential_param(args) issues = IssuesFinder.new(current_user, args).execute .preload(:assignees, :labels, :notes, :timelogs, :project, :author, :closed_by) -- cgit v1.2.3