BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
d2699aea
Commit
d2699aea
authored
Nov 13, 2017
by
Oswaldo Ferreira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add issue sidebar and toggle_subscription endpoint in board issues data
parent
bd026b6a
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
1 deletion
+9
-1
issues_controller.rb
app/controllers/boards/issues_controller.rb
+1
-0
issue.rb
app/models/issue.rb
+6
-1
issue.json
spec/fixtures/api/schemas/issue.json
+2
-0
No files found.
app/controllers/boards/issues_controller.rb
View file @
d2699aea
...
@@ -84,6 +84,7 @@ module Boards
...
@@ -84,6 +84,7 @@ module Boards
resource
.
as_json
(
resource
.
as_json
(
only:
[
:id
,
:iid
,
:project_id
,
:title
,
:confidential
,
:due_date
,
:relative_position
],
only:
[
:id
,
:iid
,
:project_id
,
:title
,
:confidential
,
:due_date
,
:relative_position
],
labels:
true
,
labels:
true
,
sidebar_endpoints:
true
,
include:
{
include:
{
project:
{
only:
[
:id
,
:path
]
},
project:
{
only:
[
:id
,
:path
]
},
assignees:
{
only:
[
:id
,
:name
,
:username
],
methods:
[
:avatar_url
]
},
assignees:
{
only:
[
:id
,
:name
,
:username
],
methods:
[
:avatar_url
]
},
...
...
app/models/issue.rb
View file @
d2699aea
...
@@ -246,7 +246,12 @@ class Issue < ActiveRecord::Base
...
@@ -246,7 +246,12 @@ class Issue < ActiveRecord::Base
def
as_json
(
options
=
{})
def
as_json
(
options
=
{})
super
(
options
).
tap
do
|
json
|
super
(
options
).
tap
do
|
json
|
json
[
:subscribed
]
=
subscribed?
(
options
[
:user
],
project
)
if
options
.
key?
(
:user
)
&&
options
[
:user
]
if
options
.
key?
(
:sidebar_endpoints
)
&&
project
url_helper
=
Gitlab
::
Routing
.
url_helpers
json
.
merge!
(
issue_sidebar_endpoint:
url_helper
.
project_issue_path
(
project
,
self
,
format: :json
,
serializer:
'sidebar'
),
toggle_subscription_endpoint:
url_helper
.
toggle_subscription_project_issue_path
(
project
,
self
))
end
if
options
.
key?
(
:labels
)
if
options
.
key?
(
:labels
)
json
[
:labels
]
=
labels
.
as_json
(
json
[
:labels
]
=
labels
.
as_json
(
...
...
spec/fixtures/api/schemas/issue.json
View file @
d2699aea
...
@@ -13,6 +13,8 @@
...
@@ -13,6 +13,8 @@
"confidential"
:
{
"type"
:
"boolean"
},
"confidential"
:
{
"type"
:
"boolean"
},
"due_date"
:
{
"type"
:
[
"date"
,
"null"
]
},
"due_date"
:
{
"type"
:
[
"date"
,
"null"
]
},
"relative_position"
:
{
"type"
:
"integer"
},
"relative_position"
:
{
"type"
:
"integer"
},
"issue_sidebar_endpoint"
:
{
"type"
:
"string"
},
"toggle_subscription_endpoint"
:
{
"type"
:
"string"
},
"project"
:
{
"project"
:
{
"id"
:
{
"type"
:
"integer"
},
"id"
:
{
"type"
:
"integer"
},
"path"
:
{
"type"
:
"string"
}
"path"
:
{
"type"
:
"string"
}
...
...
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