* Add /api/v1/admin/domain_blocks Fixes #18140 - `GET /api/v1/admin/domain_blocks` lists domain blocks - `GET /api/v1/admin/domain_blocks/:id` shows one by ID - `DELETE /api/v1/admin/domain_blocks/:id` deletes a given domain block - `POST /api/v1/admin/domain_blocks` to create a new domain block: if it conflicts with an existing one, returns an error with an attribute `existing_domain_block` with the rendered domain block * Simplify conflict handling as suggested in review
15 lines
374 B
Ruby
15 lines
374 B
Ruby
# frozen_string_literal: true
|
|
|
|
class REST::Admin::ExistingDomainBlockErrorSerializer < ActiveModel::Serializer
|
|
attributes :error
|
|
|
|
has_one :existing_domain_block, serializer: REST::Admin::DomainBlockSerializer
|
|
|
|
def error
|
|
I18n.t('admin.domain_blocks.existing_domain_block', name: existing_domain_block.domain)
|
|
end
|
|
|
|
def existing_domain_block
|
|
object
|
|
end
|
|
end
|