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 /lib/api/subscriptions.rb | |
parent | 091efb315296306fd8c8d7c109ad6df77e7f28d5 (diff) | |
download | gitlab-ce-b34c063ec428f1fd890a357a3f8ac7c129ee4c46.tar.gz |
Pass project to Entities::Label to check if user is subscribed
Diffstat (limited to 'lib/api/subscriptions.rb')
-rw-r--r-- | lib/api/subscriptions.rb | 12 |
1 files changed, 6 insertions, 6 deletions
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 |