Add API data to show/index views

This commit is contained in:
BrokenEagle
2020-01-04 01:51:37 +00:00
parent e8a96c1a2a
commit 223a6df5d8
60 changed files with 337 additions and 34 deletions

View File

@@ -94,13 +94,24 @@ class PostFlag < ApplicationRecord
end
end
def api_attributes
attributes = super + [:category]
attributes -= [:creator_id] unless CurrentUser.can_view_flagger_on_post?(self)
attributes
module ApiMethods
def api_attributes
attributes = super + [:category]
attributes -= [:creator_id] unless CurrentUser.can_view_flagger_on_post?(self)
attributes
end
def html_data_attributes
attributes = [:post_id]
if CurrentUser.can_view_flagger_on_post?(self)
attributes += [:creator_id]
end
attributes
end
end
extend SearchMethods
include ApiMethods
def category
case reason