diff options
author | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-11-01 14:06:05 -0200 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-11-17 15:10:13 -0200 |
commit | b34c063ec428f1fd890a357a3f8ac7c129ee4c46 (patch) | |
tree | 1a00aba47d314a061ffc9e4fbe49147019d85785 | |
parent | 091efb315296306fd8c8d7c109ad6df77e7f28d5 (diff) | |
download | gitlab-ce-b34c063ec428f1fd890a357a3f8ac7c129ee4c46.tar.gz |
Pass project to Entities::Label to check if user is subscribed
-rw-r--r-- | lib/api/entities.rb | 2 | ||||
-rw-r--r-- | lib/api/subscriptions.rb | 12 |
2 files changed, 7 insertions, 7 deletions
diff --git a/lib/api/entities.rb b/lib/api/entities.rb index 6e370e961c4..e7042677635 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -454,7 +454,7 @@ module API end expose :subscribed do |label, options| - label.subscribed?(options[:current_user]) + label.subscribed?(options[:current_user], options[:project]) end end diff --git a/lib/api/subscriptions.rb b/lib/api/subscriptions.rb index 00a79c24f96..10749b34004 100644 --- a/lib/api/subscriptions.rb +++ b/lib/api/subscriptions.rb @@ -24,11 +24,11 @@ module API post ":id/#{type}/:subscribable_id/subscription" do resource = instance_exec(params[:subscribable_id], &finder) - if resource.subscribed?(current_user) + if resource.subscribed?(current_user, user_project) not_modified! else - resource.subscribe(current_user) - present resource, with: entity_class, current_user: current_user + resource.subscribe(current_user, user_project) + present resource, with: entity_class, current_user: current_user, project: user_project end end @@ -38,11 +38,11 @@ module API delete ":id/#{type}/:subscribable_id/subscription" do resource = instance_exec(params[:subscribable_id], &finder) - if !resource.subscribed?(current_user) + if !resource.subscribed?(current_user, user_project) not_modified! else - resource.unsubscribe(current_user) - present resource, with: entity_class, current_user: current_user + resource.unsubscribe(current_user, user_project) + present resource, with: entity_class, current_user: current_user, project: user_project end end end |