diff options
author | Ahmad Sherif <me@ahmadsherif.com> | 2016-05-12 22:48:09 +0200 |
---|---|---|
committer | Ahmad Sherif <me@ahmadsherif.com> | 2016-05-12 22:48:09 +0200 |
commit | 0c22698bd4dbe7d0d3e4a6c8bc946ac6f5de1c12 (patch) | |
tree | 775771cbe8f3c16dedebe1f27acadd464c96099e /lib/api/helpers.rb | |
parent | 74c69709dc19dbaf56c226b5a7955f229af10f4f (diff) | |
download | gitlab-ce-0c22698bd4dbe7d0d3e4a6c8bc946ac6f5de1c12.tar.gz |
Add API endpoints for un/subscribing from/to a label
Closes #15638
Diffstat (limited to 'lib/api/helpers.rb')
-rw-r--r-- | lib/api/helpers.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb index 40c967453fb..5e638dbe16a 100644 --- a/lib/api/helpers.rb +++ b/lib/api/helpers.rb @@ -95,6 +95,17 @@ module API end end + def find_project_label(id) + label = user_project.labels.find_by_id(id) || user_project.labels.find_by_title(id) + label || not_found!('Label') + end + + def find_project_issue(id) + issue = user_project.issues.find(id) + not_found! unless can?(current_user, :read_issue, issue) + issue + end + def paginate(relation) relation.page(params[:page]).per(params[:per_page].to_i).tap do |data| add_pagination_headers(data) |