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
13aaae9f
Commit
13aaae9f
authored
May 12, 2017
by
zauberstuhl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Create shareable and visibility object on post creation
parent
c146953c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
1 deletion
+25
-1
app/controllers/comment.go
app/controllers/comment.go
+2
-1
app/controllers/post.go
app/controllers/post.go
+23
-0
No files found.
app/controllers/comment.go
View file @
13aaae9f
...
...
@@ -59,7 +59,7 @@ func (c ApiComment) Create() revel.Result {
return
c
.
RenderError
(
err
)
}
err
=
post
.
FindByID
(
postID
,
fals
e
)
err
=
post
.
FindByID
(
postID
,
tru
e
)
if
err
!=
nil
{
revel
.
ERROR
.
Println
(
err
)
return
c
.
NotFound
(
"Post not found"
)
...
...
@@ -67,6 +67,7 @@ func (c ApiComment) Create() revel.Result {
dispatcher
:=
jobs
.
Dispatcher
{
User
:
user
,
ParentPerson
:
&
post
.
Person
,
Message
:
federation
.
EntityComment
{
ParentGuid
:
post
.
Guid
,
Text
:
comment
,
...
...
app/controllers/post.go
View file @
13aaae9f
...
...
@@ -96,6 +96,29 @@ func (p ApiPost) Create() revel.Result {
return
p
.
RenderError
(
err
)
}
// this is required for mapping
// posts to the author
shareable
:=
models
.
Shareable
{
ShareableID
:
post
.
ID
,
UserID
:
user
.
ID
,
ShareableType
:
models
.
ShareablePost
,
};
if
err
:=
shareable
.
Create
();
err
!=
nil
{
revel
.
ERROR
.
Println
(
err
)
return
p
.
RenderError
(
err
)
}
// create an aspect visibillity entry
// the host has to remember the recipients
visibility
:=
models
.
AspectVisibility
{
ShareableID
:
post
.
ID
,
AspectID
:
aspectID
,
ShareableType
:
models
.
ShareablePost
,
}
if
err
:=
visibility
.
Create
();
err
!=
nil
{
revel
.
ERROR
.
Println
(
err
)
return
p
.
RenderError
(
err
)
}
dispatcher
:=
jobs
.
Dispatcher
{
User
:
user
,
AspectID
:
aspectID
,
...
...
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