@stacksjs/defaults 0.75.0 → 0.75.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -148,6 +148,21 @@ cms.comments.rejectComment(id: number): Promise<CommentablesTable>
|
|
|
148
148
|
cms.comments.deleteComment(id: number): Promise<void>
|
|
149
149
|
```
|
|
150
150
|
|
|
151
|
+
### The `commentable` trait
|
|
152
|
+
A model with `traits: { commentable: true }` (singular; `commentables` is inert) gains instance methods
|
|
153
|
+
keyed to the record's own id:
|
|
154
|
+
|
|
155
|
+
```typescript
|
|
156
|
+
await post.addComment({ body, author_name?, author_email?, user_id?, title? }, { status: 'pending' | 'approved' })
|
|
157
|
+
await post.comments() / post.approvedComments() / post.pendingComments() / post.rejectedComments() // oldest first
|
|
158
|
+
await post.commentCount()
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
Only those five fields are written, so a validated form body can go straight in; status and owner come
|
|
162
|
+
from the trait. `author_name` / `author_email` are for guest commenters (no account); never render the
|
|
163
|
+
email. Moderate without a dashboard with `buddy comments:list [--status] [--type]`,
|
|
164
|
+
`comments:approve <id>`, `comments:reject <id>`, `comments:delete <id>`.
|
|
165
|
+
|
|
151
166
|
## Routes
|
|
152
167
|
|
|
153
168
|
### CMS Admin Routes
|
package/ide/vscode/package.json
CHANGED
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@stacksjs/defaults",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"sideEffects": false,
|
|
5
|
-
"version": "0.75.
|
|
5
|
+
"version": "0.75.1",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "git+https://github.com/stacksjs/stacks.git",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"dependencies": {
|
|
56
56
|
"@iconify-json/f7": "^1.2.2",
|
|
57
57
|
"@iconify-json/hugeicons": "^1.2.27",
|
|
58
|
-
"@stacksjs/mobile": "^0.75.
|
|
58
|
+
"@stacksjs/mobile": "^0.75.1",
|
|
59
59
|
"@stacksjs/sanitizer": "^0.2.113",
|
|
60
60
|
"ts-qr-codes": "^0.1.8"
|
|
61
61
|
}
|