Refactor JSON templates to be generated with ActiveModelSerializers instead of Rabl (#4090)
This commit is contained in:
parent
2d6128672f
commit
8b2cad5637
80 changed files with 425 additions and 301 deletions
|
@ -11,11 +11,12 @@ class Api::V1::NotificationsController < Api::BaseController
|
|||
|
||||
def index
|
||||
@notifications = load_notifications
|
||||
set_maps_for_notification_target_statuses
|
||||
render json: @notifications, each_serializer: REST::NotificationSerializer, relationships: StatusRelationshipsPresenter.new(target_statuses_from_notifications, current_user&.account_id)
|
||||
end
|
||||
|
||||
def show
|
||||
@notification = current_account.notifications.find(params[:id])
|
||||
render json: @notification, serializer: REST::NotificationSerializer
|
||||
end
|
||||
|
||||
def clear
|
||||
|
@ -46,10 +47,6 @@ class Api::V1::NotificationsController < Api::BaseController
|
|||
current_account.notifications.browserable(exclude_types)
|
||||
end
|
||||
|
||||
def set_maps_for_notification_target_statuses
|
||||
set_maps target_statuses_from_notifications
|
||||
end
|
||||
|
||||
def target_statuses_from_notifications
|
||||
@notifications.reject { |notification| notification.target_status.nil? }.map(&:target_status)
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue