Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
b34c063e
Commit
b34c063e
authored
Nov 01, 2016
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pass project to Entities::Label to check if user is subscribed
parent
091efb31
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
7 deletions
+7
-7
lib/api/entities.rb
lib/api/entities.rb
+1
-1
lib/api/subscriptions.rb
lib/api/subscriptions.rb
+6
-6
No files found.
lib/api/entities.rb
View file @
b34c063e
...
@@ -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
...
...
lib/api/subscriptions.rb
View file @
b34c063e
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment