Skip to content

Commit eb76be2

Browse files
Make blog posts reportable
1 parent 1f1e0bf commit eb76be2

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

decidim-blogs/app/models/decidim/blogs/post.rb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ module Blogs
55
# The data store for a Blog in the Decidim::Blogs component. It stores a
66
# title, description and any other useful information to render a blog.
77
class Post < Blogs::ApplicationRecord
8+
include Decidim::Reportable
89
include Decidim::Resourceable
910
include Decidim::HasAttachments
1011
include Decidim::HasAttachmentCollections
@@ -84,6 +85,21 @@ def users_to_notify_on_comment_created
8485
def attachment_context
8586
:admin
8687
end
88+
89+
# Public: Overrides the `reported_content_url` Reportable concern method.
90+
def reported_content_url
91+
ResourceLocatorPresenter.new(self).url
92+
end
93+
94+
# Public: Overrides the `reported_attributes` Reportable concern method.
95+
def reported_attributes
96+
[:title, :body]
97+
end
98+
99+
# Public: Overrides the `reported_searchable_content_extras` Reportable concern method.
100+
def reported_searchable_content_extras
101+
[]
102+
end
87103
end
88104
end
89105
end

decidim-blogs/app/views/decidim/blogs/posts/_actions.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
<%= cell "decidim/share_button", nil %>
1515

16-
<%= cell "decidim/report_button", nil %>
16+
<%= cell "decidim/report_button", post %>
1717
</div>
1818
</div>
1919

0 commit comments

Comments
 (0)