Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Application Programming Interface
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
ganggo
Application Programming Interface
Commits
b8a2fe86
Commit
b8a2fe86
authored
Jan 08, 2018
by
zauberstuhl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove redirects from API
This should be handle by the application server
parent
8697ebe6
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
4 deletions
+8
-4
app/controllers/comment.go
app/controllers/comment.go
+4
-2
app/controllers/post.go
app/controllers/post.go
+4
-2
No files found.
app/controllers/comment.go
View file @
b8a2fe86
...
...
@@ -47,12 +47,13 @@ func (c ApiComment) Index() revel.Result {
func
(
c
ApiComment
)
Create
()
revel
.
Result
{
var
(
comment
string
comment
,
fields
string
postID
uint
post
models
.
Post
)
c
.
Params
.
Bind
(
&
comment
,
"comment"
)
c
.
Params
.
Bind
(
&
fields
,
"fields"
)
c
.
Params
.
Bind
(
&
postID
,
"id"
)
user
,
err
:=
models
.
CurrentUser
(
c
.
Params
,
c
.
Session
)
...
...
@@ -77,7 +78,8 @@ func (c ApiComment) Create() revel.Result {
}
go
dispatcher
.
Run
()
return
c
.
Redirect
(
"/"
)
// XXX that should return the comment
return
c
.
RenderJSON
(
post
)
}
func
(
c
ApiComment
)
Show
()
revel
.
Result
{
...
...
app/controllers/post.go
View file @
b8a2fe86
...
...
@@ -65,11 +65,12 @@ func (p ApiPost) Index() revel.Result {
func
(
p
ApiPost
)
Create
()
revel
.
Result
{
var
(
post
models
.
Post
postText
string
postText
,
fields
string
aspectID
uint
)
p
.
Params
.
Bind
(
&
postText
,
"post"
)
p
.
Params
.
Bind
(
&
fields
,
"fields"
)
p
.
Params
.
Bind
(
&
aspectID
,
"aspectID"
)
emptyPost
,
err
:=
regexp
.
MatchString
(
`^\s*?$`
,
postText
)
...
...
@@ -144,7 +145,8 @@ func (p ApiPost) Create() revel.Result {
}
go
dispatcher
.
Run
()
return
p
.
Redirect
(
"/"
)
return
p
.
RenderJSON
(
apiHelpers
.
SelectStructFields
(
post
,
fields
))
}
func
(
p
ApiPost
)
Show
(
guid
string
)
revel
.
Result
{
...
...
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