Pass project to Entities::Label to check if user is subscribed

parent 091efb31
...@@ -454,7 +454,7 @@ module API ...@@ -454,7 +454,7 @@ module API
end end
expose :subscribed do |label, options| expose :subscribed do |label, options|
label.subscribed?(options[:current_user]) label.subscribed?(options[:current_user], options[:project])
end end
end end
......
...@@ -24,11 +24,11 @@ module API ...@@ -24,11 +24,11 @@ module API
post ":id/#{type}/:subscribable_id/subscription" do post ":id/#{type}/:subscribable_id/subscription" do
resource = instance_exec(params[:subscribable_id], &finder) resource = instance_exec(params[:subscribable_id], &finder)
if resource.subscribed?(current_user) if resource.subscribed?(current_user, user_project)
not_modified! not_modified!
else else
resource.subscribe(current_user) resource.subscribe(current_user, user_project)
present resource, with: entity_class, current_user: current_user present resource, with: entity_class, current_user: current_user, project: user_project
end end
end end
...@@ -38,11 +38,11 @@ module API ...@@ -38,11 +38,11 @@ module API
delete ":id/#{type}/:subscribable_id/subscription" do delete ":id/#{type}/:subscribable_id/subscription" do
resource = instance_exec(params[:subscribable_id], &finder) resource = instance_exec(params[:subscribable_id], &finder)
if !resource.subscribed?(current_user) if !resource.subscribed?(current_user, user_project)
not_modified! not_modified!
else else
resource.unsubscribe(current_user) resource.unsubscribe(current_user, user_project)
present resource, with: entity_class, current_user: current_user present resource, with: entity_class, current_user: current_user, project: user_project
end end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment