Skip to content

Commit c2153cd

Browse files
authored
Update admin/domain_blocks to include conflict response
When creating a domain block, if there is already a domain block rule for the domain, then the existing block is returned. This documents that behavior. I've also documented the `digest` property which was added in mastodon/mastodon#29092
1 parent 046da5d commit c2153cd

File tree

1 file changed

+31
-5
lines changed

1 file changed

+31
-5
lines changed

content/en/methods/admin/domain_blocks.md

+31-5
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ limit
6060
{
6161
"id": "1",
6262
"domain": "example.com",
63+
"digest": "a379a6f6eeafb9a55e378c118034e2751e682fab9f2d30ab13d2125586ce1947",
6364
"created_at": "2022-11-16T08:15:34.238Z",
6465
"severity": "noop",
6566
"reject_media": false,
@@ -120,6 +121,7 @@ Authorization
120121
{
121122
"id": "1",
122123
"domain": "example.com",
124+
"digest": "a379a6f6eeafb9a55e378c118034e2751e682fab9f2d30ab13d2125586ce1947",
123125
"created_at": "2022-11-16T08:15:34.238Z",
124126
"severity": "noop",
125127
"reject_media": false,
@@ -146,7 +148,7 @@ DomainBlock with the given ID does not exist
146148

147149
```json
148150
{
149-
"error": "Record not found"
151+
"error": "Record not found"
150152
}
151153
```
152154

@@ -205,6 +207,7 @@ Domain has been blocked from federating.
205207
{
206208
"id": "1",
207209
"domain": "example.com",
210+
"digest": "a379a6f6eeafb9a55e378c118034e2751e682fab9f2d30ab13d2125586ce1947",
208211
"created_at": "2022-11-16T08:15:34.238Z",
209212
"severity": "noop",
210213
"reject_media": false,
@@ -225,13 +228,35 @@ Authorized user is not allowed to perform this action, or invalid or missing Aut
225228
}
226229
```
227230

228-
##### 422: Unprocessable entity
231+
##### 422: Unprocessable entity - Missing Parameter
229232

230233
The domain parameter was not provided
231234

232235
```json
233236
{
234-
"error": "Validation failed: Domain can't be blank"
237+
"error": "Validation failed: Domain can't be blank"
238+
}
239+
```
240+
241+
##### 422: Unprocessable entity - Existing Domain Block
242+
243+
The domain parameter already is covered by an existing domain block.
244+
245+
```json
246+
{
247+
"error": "You have already imposed stricter limits on example.com."
248+
"existing_domain_block": {
249+
"id": "1",
250+
"domain": "example.com",
251+
"digest": "a379a6f6eeafb9a55e378c118034e2751e682fab9f2d30ab13d2125586ce1947",
252+
"created_at": "2022-11-16T08:15:34.238Z",
253+
"severity": "noop",
254+
"reject_media": false,
255+
"reject_reports": false,
256+
"private_comment": null,
257+
"public_comment": null,
258+
"obfuscate": false
259+
}
235260
}
236261
```
237262

@@ -292,6 +317,7 @@ Domain block has been updated
292317
{
293318
"id": "1",
294319
"domain": "example.com",
320+
"digest": "a379a6f6eeafb9a55e378c118034e2751e682fab9f2d30ab13d2125586ce1947",
295321
"created_at": "2022-11-16T08:15:34.238Z",
296322
"severity": "noop",
297323
"reject_media": false,
@@ -368,12 +394,12 @@ DomainBlock with the given ID does not exist
368394

369395
```json
370396
{
371-
"error": "Record not found"
397+
"error": "Record not found"
372398
}
373399
```
374400

375401
---
376402

377403
## See also
378404

379-
{{< caption-link url="https://github.com/mastodon/mastodon/blob/main/app/controllers/api/v1/admin/domain_blocks_controller.rb" caption="app/controllers/api/v1/admin/domain_blocks_controller.rb" >}}
405+
{{< caption-link url="https://github.com/mastodon/mastodon/blob/main/app/controllers/api/v1/admin/domain_blocks_controller.rb" caption="app/controllers/api/v1/admin/domain_blocks_controller.rb" >}}

0 commit comments

Comments
 (0)