Skip to content

Commit 34e4ab6

Browse files
committed
Added can_comment and comment_ban fields to members schema
ref https://linear.app/ghost/issue/FEA-487 This enables the Admin API to accept comment moderation fields when creating or editing members: - can_comment (boolean): indicates if member can post comments - comment_ban (object|null): stores ban metadata with reason and optional expires_at
1 parent 848a334 commit 34e4ab6

File tree

6 files changed

+79
-1
lines changed

6 files changed

+79
-1
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$id": "comment_bans.add",
4+
"title": "comment_bans.add",
5+
"description": "Schema for comment_bans.add",
6+
"type": "object",
7+
"additionalProperties": false,
8+
"properties": {
9+
"comment_bans": {
10+
"type": "array",
11+
"minItems": 1,
12+
"maxItems": 1,
13+
"items": {
14+
"allOf": [{ "$ref": "comment_bans#/definitions/comment_ban" }]
15+
}
16+
}
17+
},
18+
"required": ["comment_bans"]
19+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$id": "comment_bans",
4+
"title": "comment_bans",
5+
"description": "Base comment_bans definitions",
6+
"definitions": {
7+
"comment_ban": {
8+
"type": "object",
9+
"additionalProperties": false,
10+
"properties": {
11+
"reason": {
12+
"type": "string",
13+
"minLength": 1,
14+
"maxLength": 2000
15+
},
16+
"expires_at": {
17+
"type": ["string", "null"],
18+
"format": "date-time"
19+
}
20+
},
21+
"required": ["reason"]
22+
}
23+
}
24+
}

packages/admin-api-schema/lib/schemas/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
module.exports = [
2+
'comment_bans-add',
23
'images-upload',
34
'media-upload',
45
'labels-add',

packages/admin-api-schema/lib/schemas/members-edit.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,23 @@
5050
},
5151
"labels": {
5252
"$ref": "members#/definitions/member-labels"
53+
},
54+
"can_comment": {
55+
"type": "boolean"
56+
},
57+
"comment_ban": {
58+
"oneOf": [
59+
{
60+
"type": "object",
61+
"additionalProperties": false,
62+
"properties": {
63+
"reason": { "type": "string", "minLength": 1, "maxLength": 2000 },
64+
"expires_at": { "type": ["string", "null"], "format": "date-time" }
65+
},
66+
"required": ["reason"]
67+
},
68+
{ "type": "null" }
69+
]
5370
}
5471
}
5572
}

packages/admin-api-schema/lib/schemas/members.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,23 @@
4747
},
4848
"newsletters": {
4949
"$ref": "#/definitions/member-newsletters"
50+
},
51+
"can_comment": {
52+
"type": "boolean"
53+
},
54+
"comment_ban": {
55+
"oneOf": [
56+
{
57+
"type": "object",
58+
"additionalProperties": false,
59+
"properties": {
60+
"reason": { "type": "string", "minLength": 1, "maxLength": 2000 },
61+
"expires_at": { "type": ["string", "null"], "format": "date-time" }
62+
},
63+
"required": ["reason"]
64+
},
65+
{ "type": "null" }
66+
]
5067
}
5168
}
5269
},

packages/admin-api-schema/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@tryghost/admin-api-schema",
3-
"version": "4.5.13",
3+
"version": "4.6.0",
44
"repository": {
55
"type": "git",
66
"url": "git+https://github.com/TryGhost/SDK.git",

0 commit comments

Comments
 (0)