Pass project to Entities::Label to check if user is subscribed
This commit is contained in:
parent
091efb3152
commit
b34c063ec4
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue