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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
fb2fde9d
Commit
fb2fde9d
authored
Apr 08, 2016
by
Robert Schilling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
API: Expose subscribed? on issues
parent
b30ebdaa
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
46 additions
and
25 deletions
+46
-25
CHANGELOG
CHANGELOG
+1
-0
doc/api/issues.md
doc/api/issues.md
+11
-6
doc/api/merge_requests.md
doc/api/merge_requests.md
+13
-6
lib/api/entities.rb
lib/api/entities.rb
+8
-0
lib/api/issues.rb
lib/api/issues.rb
+5
-5
lib/api/merge_requests.rb
lib/api/merge_requests.rb
+7
-7
lib/api/milestones.rb
lib/api/milestones.rb
+1
-1
No files found.
CHANGELOG
View file @
fb2fde9d
...
@@ -12,6 +12,7 @@ v 8.7.0 (unreleased)
...
@@ -12,6 +12,7 @@ v 8.7.0 (unreleased)
- Allow back dating on issues when created through the API
- Allow back dating on issues when created through the API
- Fix Error 500 after renaming a project path (Stan Hu)
- Fix Error 500 after renaming a project path (Stan Hu)
- Fix avatar stretching by providing a cropping feature
- Fix avatar stretching by providing a cropping feature
- API: Expose `subscribed` for issues and merge requests (Robert Schilling)
- Allow SAML to handle external users based on user's information !3530
- Allow SAML to handle external users based on user's information !3530
- Add endpoints to archive or unarchive a project !3372
- Add endpoints to archive or unarchive a project !3372
- Add links to CI setup documentation from project settings and builds pages
- Add links to CI setup documentation from project settings and builds pages
...
...
doc/api/issues.md
View file @
fb2fde9d
...
@@ -76,8 +76,9 @@ Example response:
...
@@ -76,8 +76,9 @@ Example response:
"title"
:
"Consequatur vero maxime deserunt laboriosam est voluptas dolorem."
,
"title"
:
"Consequatur vero maxime deserunt laboriosam est voluptas dolorem."
,
"created_at"
:
"2016-01-04T15:31:51.081Z"
,
"created_at"
:
"2016-01-04T15:31:51.081Z"
,
"iid"
:
6
,
"iid"
:
6
,
"labels"
:
[]
"labels"
:
[],
},
"subscribed"
:
false
}
]
]
```
```
...
@@ -152,7 +153,8 @@ Example response:
...
@@ -152,7 +153,8 @@ Example response:
"id"
:
41
,
"id"
:
41
,
"title"
:
"Ut commodi ullam eos dolores perferendis nihil sunt."
,
"title"
:
"Ut commodi ullam eos dolores perferendis nihil sunt."
,
"updated_at"
:
"2016-01-04T15:31:46.176Z"
,
"updated_at"
:
"2016-01-04T15:31:46.176Z"
,
"created_at"
:
"2016-01-04T15:31:46.176Z"
"created_at"
:
"2016-01-04T15:31:46.176Z"
,
"subscribed"
:
false
}
}
]
]
```
```
...
@@ -213,7 +215,8 @@ Example response:
...
@@ -213,7 +215,8 @@ Example response:
"id"
:
41
,
"id"
:
41
,
"title"
:
"Ut commodi ullam eos dolores perferendis nihil sunt."
,
"title"
:
"Ut commodi ullam eos dolores perferendis nihil sunt."
,
"updated_at"
:
"2016-01-04T15:31:46.176Z"
,
"updated_at"
:
"2016-01-04T15:31:46.176Z"
,
"created_at"
:
"2016-01-04T15:31:46.176Z"
"created_at"
:
"2016-01-04T15:31:46.176Z"
,
"subscribed"
:
false
}
}
```
```
...
@@ -267,7 +270,8 @@ Example response:
...
@@ -267,7 +270,8 @@ Example response:
},
},
"description"
:
null
,
"description"
:
null
,
"updated_at"
:
"2016-01-07T12:44:33.959Z"
,
"updated_at"
:
"2016-01-07T12:44:33.959Z"
,
"milestone"
:
null
"milestone"
:
null
,
"subscribed"
:
true
}
}
```
```
...
@@ -323,7 +327,8 @@ Example response:
...
@@ -323,7 +327,8 @@ Example response:
],
],
"id"
:
85
,
"id"
:
85
,
"assignee"
:
null
,
"assignee"
:
null
,
"milestone"
:
null
"milestone"
:
null
,
"subscribed"
:
true
}
}
```
```
...
...
doc/api/merge_requests.md
View file @
fb2fde9d
...
@@ -66,7 +66,8 @@ Parameters:
...
@@ -66,7 +66,8 @@ Parameters:
"due_date"
:
null
"due_date"
:
null
},
},
"merge_when_build_succeeds"
:
true
,
"merge_when_build_succeeds"
:
true
,
"merge_status"
:
"can_be_merged"
"merge_status"
:
"can_be_merged"
,
"subscribed"
:
false
}
}
]
]
```
```
...
@@ -128,7 +129,8 @@ Parameters:
...
@@ -128,7 +129,8 @@ Parameters:
"due_date"
:
null
"due_date"
:
null
},
},
"merge_when_build_succeeds"
:
true
,
"merge_when_build_succeeds"
:
true
,
"merge_status"
:
"can_be_merged"
"merge_status"
:
"can_be_merged"
,
"subscribed"
:
true
}
}
```
```
...
@@ -227,6 +229,7 @@ Parameters:
...
@@ -227,6 +229,7 @@ Parameters:
},
},
"merge_when_build_succeeds"
:
true
,
"merge_when_build_succeeds"
:
true
,
"merge_status"
:
"can_be_merged"
,
"merge_status"
:
"can_be_merged"
,
"subscribed"
:
true
,
"changes"
:
[
"changes"
:
[
{
{
"old_path"
:
"VERSION"
,
"old_path"
:
"VERSION"
,
...
@@ -304,7 +307,8 @@ Parameters:
...
@@ -304,7 +307,8 @@ Parameters:
"due_date"
:
null
"due_date"
:
null
},
},
"merge_when_build_succeeds"
:
true
,
"merge_when_build_succeeds"
:
true
,
"merge_status"
:
"can_be_merged"
"merge_status"
:
"can_be_merged"
,
"subscribed"
:
true
}
}
```
```
...
@@ -373,7 +377,8 @@ Parameters:
...
@@ -373,7 +377,8 @@ Parameters:
"due_date"
:
null
"due_date"
:
null
},
},
"merge_when_build_succeeds"
:
true
,
"merge_when_build_succeeds"
:
true
,
"merge_status"
:
"can_be_merged"
"merge_status"
:
"can_be_merged"
,
"subscribed"
:
true
}
}
```
```
...
@@ -466,7 +471,8 @@ Parameters:
...
@@ -466,7 +471,8 @@ Parameters:
"due_date"
:
null
"due_date"
:
null
},
},
"merge_when_build_succeeds"
:
true
,
"merge_when_build_succeeds"
:
true
,
"merge_status"
:
"can_be_merged"
"merge_status"
:
"can_be_merged"
,
"subscribed"
:
true
}
}
```
```
...
@@ -530,7 +536,8 @@ Parameters:
...
@@ -530,7 +536,8 @@ Parameters:
"due_date"
:
null
"due_date"
:
null
},
},
"merge_when_build_succeeds"
:
true
,
"merge_when_build_succeeds"
:
true
,
"merge_status"
:
"can_be_merged"
"merge_status"
:
"can_be_merged"
,
"subscribed"
:
true
}
}
```
```
...
...
lib/api/entities.rb
View file @
fb2fde9d
...
@@ -170,6 +170,10 @@ module API
...
@@ -170,6 +170,10 @@ module API
expose
:label_names
,
as: :labels
expose
:label_names
,
as: :labels
expose
:milestone
,
using:
Entities
::
Milestone
expose
:milestone
,
using:
Entities
::
Milestone
expose
:assignee
,
:author
,
using:
Entities
::
UserBasic
expose
:assignee
,
:author
,
using:
Entities
::
UserBasic
expose
:subscribed
do
|
issue
,
options
|
issue
.
subscribed?
(
options
[
:current_user
])
end
end
end
class
MergeRequest
<
ProjectEntity
class
MergeRequest
<
ProjectEntity
...
@@ -183,6 +187,10 @@ module API
...
@@ -183,6 +187,10 @@ module API
expose
:milestone
,
using:
Entities
::
Milestone
expose
:milestone
,
using:
Entities
::
Milestone
expose
:merge_when_build_succeeds
expose
:merge_when_build_succeeds
expose
:merge_status
expose
:merge_status
expose
:subscribed
do
|
merge_request
,
options
|
merge_request
.
subscribed?
(
options
[
:current_user
])
end
end
end
class
MergeRequestChanges
<
MergeRequest
class
MergeRequestChanges
<
MergeRequest
...
...
lib/api/issues.rb
View file @
fb2fde9d
...
@@ -55,7 +55,7 @@ module API
...
@@ -55,7 +55,7 @@ module API
issues
=
filter_issues_state
(
issues
,
params
[
:state
])
unless
params
[
:state
].
nil?
issues
=
filter_issues_state
(
issues
,
params
[
:state
])
unless
params
[
:state
].
nil?
issues
=
filter_issues_labels
(
issues
,
params
[
:labels
])
unless
params
[
:labels
].
nil?
issues
=
filter_issues_labels
(
issues
,
params
[
:labels
])
unless
params
[
:labels
].
nil?
issues
.
reorder
(
issuable_order_by
=>
issuable_sort
)
issues
.
reorder
(
issuable_order_by
=>
issuable_sort
)
present
paginate
(
issues
),
with:
Entities
::
Issue
present
paginate
(
issues
),
with:
Entities
::
Issue
,
current_user:
current_user
end
end
end
end
...
@@ -92,7 +92,7 @@ module API
...
@@ -92,7 +92,7 @@ module API
end
end
issues
.
reorder
(
issuable_order_by
=>
issuable_sort
)
issues
.
reorder
(
issuable_order_by
=>
issuable_sort
)
present
paginate
(
issues
),
with:
Entities
::
Issue
present
paginate
(
issues
),
with:
Entities
::
Issue
,
current_user:
current_user
end
end
# Get a single project issue
# Get a single project issue
...
@@ -105,7 +105,7 @@ module API
...
@@ -105,7 +105,7 @@ module API
get
":id/issues/:issue_id"
do
get
":id/issues/:issue_id"
do
@issue
=
user_project
.
issues
.
find
(
params
[
:issue_id
])
@issue
=
user_project
.
issues
.
find
(
params
[
:issue_id
])
not_found!
unless
can?
(
current_user
,
:read_issue
,
@issue
)
not_found!
unless
can?
(
current_user
,
:read_issue
,
@issue
)
present
@issue
,
with:
Entities
::
Issue
present
@issue
,
with:
Entities
::
Issue
,
current_user:
current_user
end
end
# Create a new project issue
# Create a new project issue
...
@@ -149,7 +149,7 @@ module API
...
@@ -149,7 +149,7 @@ module API
issue
.
add_labels_by_names
(
params
[
:labels
].
split
(
','
))
issue
.
add_labels_by_names
(
params
[
:labels
].
split
(
','
))
end
end
present
issue
,
with:
Entities
::
Issue
present
issue
,
with:
Entities
::
Issue
,
current_user:
current_user
else
else
render_validation_error!
(
issue
)
render_validation_error!
(
issue
)
end
end
...
@@ -189,7 +189,7 @@ module API
...
@@ -189,7 +189,7 @@ module API
issue
.
add_labels_by_names
(
params
[
:labels
].
split
(
','
))
issue
.
add_labels_by_names
(
params
[
:labels
].
split
(
','
))
end
end
present
issue
,
with:
Entities
::
Issue
present
issue
,
with:
Entities
::
Issue
,
current_user:
current_user
else
else
render_validation_error!
(
issue
)
render_validation_error!
(
issue
)
end
end
...
...
lib/api/merge_requests.rb
View file @
fb2fde9d
...
@@ -56,7 +56,7 @@ module API
...
@@ -56,7 +56,7 @@ module API
end
end
merge_requests
=
merge_requests
.
reorder
(
issuable_order_by
=>
issuable_sort
)
merge_requests
=
merge_requests
.
reorder
(
issuable_order_by
=>
issuable_sort
)
present
paginate
(
merge_requests
),
with:
Entities
::
MergeRequest
present
paginate
(
merge_requests
),
with:
Entities
::
MergeRequest
,
current_user:
current_user
end
end
# Create MR
# Create MR
...
@@ -94,7 +94,7 @@ module API
...
@@ -94,7 +94,7 @@ module API
merge_request
.
add_labels_by_names
(
params
[
:labels
].
split
(
","
))
merge_request
.
add_labels_by_names
(
params
[
:labels
].
split
(
","
))
end
end
present
merge_request
,
with:
Entities
::
MergeRequest
present
merge_request
,
with:
Entities
::
MergeRequest
,
current_user:
current_user
else
else
handle_merge_request_errors!
merge_request
.
errors
handle_merge_request_errors!
merge_request
.
errors
end
end
...
@@ -130,7 +130,7 @@ module API
...
@@ -130,7 +130,7 @@ module API
authorize!
:read_merge_request
,
merge_request
authorize!
:read_merge_request
,
merge_request
present
merge_request
,
with:
Entities
::
MergeRequest
present
merge_request
,
with:
Entities
::
MergeRequest
,
current_user:
current_user
end
end
# Show MR commits
# Show MR commits
...
@@ -162,7 +162,7 @@ module API
...
@@ -162,7 +162,7 @@ module API
merge_request
=
user_project
.
merge_requests
.
merge_request
=
user_project
.
merge_requests
.
find
(
params
[
:merge_request_id
])
find
(
params
[
:merge_request_id
])
authorize!
:read_merge_request
,
merge_request
authorize!
:read_merge_request
,
merge_request
present
merge_request
,
with:
Entities
::
MergeRequestChanges
present
merge_request
,
with:
Entities
::
MergeRequestChanges
,
current_user:
current_user
end
end
# Update MR
# Update MR
...
@@ -204,7 +204,7 @@ module API
...
@@ -204,7 +204,7 @@ module API
merge_request
.
add_labels_by_names
(
params
[
:labels
].
split
(
","
))
merge_request
.
add_labels_by_names
(
params
[
:labels
].
split
(
","
))
end
end
present
merge_request
,
with:
Entities
::
MergeRequest
present
merge_request
,
with:
Entities
::
MergeRequest
,
current_user:
current_user
else
else
handle_merge_request_errors!
merge_request
.
errors
handle_merge_request_errors!
merge_request
.
errors
end
end
...
@@ -246,7 +246,7 @@ module API
...
@@ -246,7 +246,7 @@ module API
execute
(
merge_request
)
execute
(
merge_request
)
end
end
present
merge_request
,
with:
Entities
::
MergeRequest
present
merge_request
,
with:
Entities
::
MergeRequest
,
current_user:
current_user
end
end
# Cancel Merge if Merge When build succeeds is enabled
# Cancel Merge if Merge When build succeeds is enabled
...
@@ -325,7 +325,7 @@ module API
...
@@ -325,7 +325,7 @@ module API
get
"
#{
path
}
/closes_issues"
do
get
"
#{
path
}
/closes_issues"
do
merge_request
=
user_project
.
merge_requests
.
find
(
params
[
:merge_request_id
])
merge_request
=
user_project
.
merge_requests
.
find
(
params
[
:merge_request_id
])
issues
=
::
Kaminari
.
paginate_array
(
merge_request
.
closes_issues
(
current_user
))
issues
=
::
Kaminari
.
paginate_array
(
merge_request
.
closes_issues
(
current_user
))
present
paginate
(
issues
),
with:
Entities
::
Issue
present
paginate
(
issues
),
with:
Entities
::
Issue
,
current_user:
current_user
end
end
end
end
end
end
...
...
lib/api/milestones.rb
View file @
fb2fde9d
...
@@ -103,7 +103,7 @@ module API
...
@@ -103,7 +103,7 @@ module API
authorize!
:read_milestone
,
user_project
authorize!
:read_milestone
,
user_project
@milestone
=
user_project
.
milestones
.
find
(
params
[
:milestone_id
])
@milestone
=
user_project
.
milestones
.
find
(
params
[
:milestone_id
])
present
paginate
(
@milestone
.
issues
),
with:
Entities
::
Issue
present
paginate
(
@milestone
.
issues
),
with:
Entities
::
Issue
,
current_user:
current_user
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