feat(tickets): make ticket title/content/reply length limits configurable
Add ticket_title_max / ticket_content_max / ticket_reply_max to the users/ticket schema (PHP + SPA) with clamped TicketSettings readers. All write paths (front REST, admin REST, note REST, native admin page) and front-end maxlength/counters now read the configured limits. Remove the hardcoded TICKET_CONTENT_MAX constant. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6681b0c306
commit
63ab8b8fc9
13 files changed
+71
-28
No files matched your search
@@ -26,6 +26,9 @@ const FIELD_ORDER = [
|
||||
'ticket_attachment_max',
|
||||
'ticket_order_link_s',
|
||||
'ticket_urge_interval',
|
||||
'ticket_title_max',
|
||||
'ticket_content_max',
|
||||
'ticket_reply_max',
|
||||
];
|
||||
|
||||
const GROUPS = [
|
||||
@@ -128,6 +131,11 @@ test('TicketSettings falls back to schema defaults and clamps numerics', () => {
|
||||
assert.match(body, /max\(1, min\(9, \(int\)/);
|
||||
assert.match(body, /max\(1, min\(1440, \(int\)/);
|
||||
|
||||
// 字数上限:标题 10..200(VARCHAR(200)),描述 / 回复 100..16000(TEXT 65535 字节 / utf8mb4)。
|
||||
assert.match(body, /max\(10, min\(200, \(int\) \(self::all\(\)\['ticket_title_max'\] \?\? 200\)\)\)/);
|
||||
assert.match(body, /max\(100, min\(16000, \(int\) \(self::all\(\)\['ticket_content_max'\] \?\? 5000\)\)\)/);
|
||||
assert.match(body, /max\(100, min\(16000, \(int\) \(self::all\(\)\['ticket_reply_max'\] \?\? 3000\)\)\)/);
|
||||
|
||||
// 公告文案走 kses(后台允许 HTML)。
|
||||
assert.match(body, /wp_kses_post/);
|
||||
// 分区名与 schema key 一致(常量在 all() 之前声明,故对整份文件断言)。
|
||||
|
||||
Reference in new issue
Block a user