Method: ActivityNotification::NotificationsApiController#open_all

Defined in:
app/controllers/activity_notification/notifications_api_controller.rb

#open_all(params) ⇒ JSON

Opens all notifications of the target.

POST /:target_type/:target_id/notifications/open_all

Returns count: number of opened notification records, notifications: opened notifications.

Parameters:

  • params (Hash)

    Request parameters

Options Hash (params):

  • :filtered_by_type (String) — default: nil

    Notifiable type to filter notification index

  • :filtered_by_group_type (String) — default: nil

    Group type to filter notification index, valid with :filtered_by_group_id

  • :filtered_by_group_id (String) — default: nil

    Group instance ID to filter notification index, valid with :filtered_by_group_type

  • :filtered_by_key (String) — default: nil

    Key of notifications to filter notification index

  • :later_than (String) — default: nil

    ISO 8601 format time to filter notification index later than specified time

  • :earlier_than (String) — default: nil

    ISO 8601 format time to filter notification index earlier than specified time

  • :ids (Array) — default: nil

    Array of specific notification IDs to open

Returns:

  • (JSON)

    count: number of opened notification records, notifications: opened notifications



49
50
51
52
53
54
55
# File 'app/controllers/activity_notification/notifications_api_controller.rb', line 49

def open_all
  super
  render json: {
    count: @opened_notifications.size,
    notifications: @opened_notifications.as_json(notification_json_options)
  }
end