Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
diaspora
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Gigadoc 2
diaspora
Commits
6e74ee7d
Commit
6e74ee7d
authored
Aug 21, 2015
by
theworldbright
Committed by
Jonne Haß
Aug 23, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make PostPresenter inherit from BasePresenter
closes #6315
parent
335b1c32
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
7 deletions
+4
-7
Changelog.md
Changelog.md
+1
-0
app/presenters/post_interaction_presenter.rb
app/presenters/post_interaction_presenter.rb
+1
-1
app/presenters/post_presenter.rb
app/presenters/post_presenter.rb
+2
-6
No files found.
Changelog.md
View file @
6e74ee7d
...
...
@@ -9,6 +9,7 @@
*
Refactor HomeController#toggle
\_
mobile
[
#6260
](
https://github.com/diaspora/diaspora/pull/6260
)
*
Extract CommentService from CommentsController
[
#6307
](
https://github.com/diaspora/diaspora/pull/6307
)
*
Extract user/profile discovery into the diaspora
\_
federation-rails gem
[
#6310
](
https://github.com/diaspora/diaspora/pull/6310
)
*
Refactor PostPresenter
[
#6315
](
https://github.com/diaspora/diaspora/pull/6315
)
## Bug fixes
*
Fix indentation and a link title on the default home page
[
#6212
](
https://github.com/diaspora/diaspora/pull/6212
)
...
...
app/presenters/post_interaction_presenter.rb
View file @
6e74ee7d
...
...
@@ -7,7 +7,7 @@ class PostInteractionPresenter
def
as_json
(
_options
=
{})
{
likes:
as_api
(
@post
.
likes
),
reshares:
PostPresenter
.
collection_json
(
@post
.
reshares
,
@current_user
),
reshares:
PostPresenter
.
as_collection
(
@post
.
reshares
,
:as_json
,
@current_user
),
comments:
CommentPresenter
.
as_collection
(
@post
.
comments
.
order
(
"created_at ASC"
)),
participations:
as_api
(
participations
),
comments_count:
@post
.
comments_count
,
...
...
app/presenters/post_presenter.rb
View file @
6e74ee7d
class
PostPresenter
class
PostPresenter
<
BasePresenter
include
PostsHelper
attr_accessor
:post
,
:current_user
attr_accessor
:post
def
initialize
(
post
,
current_user
=
nil
)
@post
=
post
@current_user
=
current_user
end
def
self
.
collection_json
(
collection
,
current_user
)
collection
.
map
{
|
post
|
PostPresenter
.
new
(
post
,
current_user
)
}
end
def
as_json
(
_options
=
{})
@post
.
include_root_in_json
=
false
@post
.
as_json
(
only:
directly_retrieved_attributes
).
merge
(
non_directly_retrieved_attributes
)
...
...
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