Ver Fonte

feat(discussions): issue 的严重程度 info 改为 suggestion

- Discussion::SEVERITIES:issue 为 error / warning / suggestion(help 仍为 urgent / normal)
- 控制器文档的枚举、测试、migration 注释跟着改;规格与 schema.d.ts 重新生成
- 前端新建话题的 severity 选项;SeverityTag 中 suggestion 为蓝色
- 开发库没有 info 的存量数据

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
visuddhinanda há 4 dias atrás
pai
commit
f9aacc2057

+ 3 - 3
api-v13/app/Http/Controllers/V3/DiscussionController.php

@@ -69,7 +69,7 @@ class DiscussionController extends Controller
      * 发起话题或新建批注
      *
      * discussion / issue 登录即可发;qa / help 只能发在文章上,且只有文章的编辑者能发。
-     * severity 的取值随 type:issue 为 error / warning / info,help 为 urgent / normal,
+     * severity 的取值随 type:issue 为 error / warning / suggestion,help 为 urgent / normal,
      * 其它类型不收。默认会通知对象的作者(站内信 + webhook),`notify=false` 关闭。
      *
      * 批注(note / commentary)只能加在句子上,且只有该句所在 channel 的编辑者能加;
@@ -84,7 +84,7 @@ class DiscussionController extends Controller
      * @bodyParam type string 类型。Enum: discussion,qa,help,issue,note,commentary Default: discussion
      * @bodyParam title string 标题,最长 256 字符;评论线程必填,批注可省
      * @bodyParam content string 正文(markdown);批注必填
-     * @bodyParam severity string 严重程度。Enum: error,warning,info,urgent,normal
+     * @bodyParam severity string 严重程度。Enum: error,warning,suggestion,urgent,normal
      * @bodyParam pos_start integer 批注锚点在句子文本中的起始偏移(只限批注)
      * @bodyParam pos_end integer 批注锚点的结束偏移,批注插在这里(只限批注)
      * @bodyParam quote_exact string 锚定的原文片段(只限批注)
@@ -140,7 +140,7 @@ class DiscussionController extends Controller
      * @bodyParam content string 正文(markdown)
      * @bodyParam status string 状态(只限话题)。Enum: active,close
      * @bodyParam type string 类型(只限话题;评论线程与批注不能互转)。Enum: discussion,qa,help,issue,note,commentary
-     * @bodyParam severity string 严重程度(只限话题),null 表示清空。Enum: error,warning,info,urgent,normal
+     * @bodyParam severity string 严重程度(只限话题),null 表示清空。Enum: error,warning,suggestion,urgent,normal
      * @bodyParam pos_start integer 锚点起始偏移(只限批注)
      * @bodyParam pos_end integer 锚点结束偏移(只限批注)
      * @bodyParam quote_exact string 锚定的原文片段(只限批注)

+ 1 - 1
api-v13/app/Models/Discussion.php

@@ -82,7 +82,7 @@ class Discussion extends Model
 
     /** 各类型允许的 severity 取值;不在表里的类型不允许设 severity */
     public const SEVERITIES = [
-        'issue' => ['error', 'warning', 'info'],
+        'issue' => ['error', 'warning', 'suggestion'],
         'help' => ['urgent', 'normal'],
     ];
 

+ 1 - 1
api-v13/database/migrations/2026_10_13_100000_add_severity_in_discussions.php

@@ -8,7 +8,7 @@ return new class extends Migration
 {
     /**
      * 给 discussions 增加严重/紧急程度 severity,取值随 type 而定:
-     * - type=issue → error / warning / info
+     * - type=issue → error / warning / suggestion
      * - type=help  → urgent / normal
      *
      * nullable:存量数据与 dashboard-v4(v2 写入)都不会带这个值。

+ 1 - 1
api-v13/tests/Feature/DiscussionV3Test.php

@@ -121,7 +121,7 @@ it('filters topics by type, status and severity', function () {
     $owner = makeStudio('owner');
     $target = makeTargetSentence($owner);
     makeDiscussion(['res_id' => $target, 'type' => 'issue', 'severity' => 'error']);
-    makeDiscussion(['res_id' => $target, 'type' => 'issue', 'severity' => 'info']);
+    makeDiscussion(['res_id' => $target, 'type' => 'issue', 'severity' => 'suggestion']);
     makeDiscussion(['res_id' => $target, 'type' => 'issue', 'severity' => 'warning', 'status' => 'close']);
     makeDiscussion(['res_id' => $target]);
 

+ 1 - 1
dashboard-v6/src/api/discussion.ts

@@ -71,7 +71,7 @@ export type TDiscussionStatus = NonNullable<TopicQuery["status"]>;
  * 规格里 severity 是几种类型的并集,按类型拆分只能写在这里。
  */
 export const SEVERITY_OPTIONS: Partial<Record<TDiscussionType, TSeverity[]>> = {
-  issue: ["error", "warning", "info"],
+  issue: ["error", "warning", "suggestion"],
   help: ["urgent", "normal"],
 };
 

+ 3 - 3
dashboard-v6/src/api/schema.d.ts

@@ -7737,7 +7737,7 @@ export interface paths {
         /**
          * 发起话题或新建批注
          * @description discussion / issue 登录即可发;qa / help 只能发在文章上,且只有文章的编辑者能发。
-         *     severity 的取值随 type:issue 为 error / warning / info,help 为 urgent / normal,
+         *     severity 的取值随 type:issue 为 error / warning / suggestion,help 为 urgent / normal,
          *     其它类型不收。默认会通知对象的作者(站内信 + webhook),`notify=false` 关闭。
          *     批注(note / commentary)只能加在句子上,且只有该句所在 channel 的编辑者能加;
          *     标题可省、正文必填,commentary 的正文必须是义注句子模板 `{{book-para-start-end}}`
@@ -34604,7 +34604,7 @@ export interface operations {
                      * @description 严重程度
                      * @enum {string}
                      */
-                    severity?: "error" | "warning" | "info" | "urgent" | "normal";
+                    severity?: "error" | "warning" | "suggestion" | "urgent" | "normal";
                     /** @description 批注锚点在句子文本中的起始偏移(只限批注) */
                     pos_start?: number;
                     /** @description 批注锚点的结束偏移,批注插在这里(只限批注) */
@@ -35034,7 +35034,7 @@ export interface operations {
                      * @description 严重程度(只限话题),null 表示清空
                      * @enum {string}
                      */
-                    severity?: "error" | "warning" | "info" | "urgent" | "normal";
+                    severity?: "error" | "warning" | "suggestion" | "urgent" | "normal";
                     /** @description 锚点起始偏移(只限批注) */
                     pos_start?: number;
                     /** @description 锚点结束偏移(只限批注) */

+ 1 - 1
openapi/public/assets/protocol/resources/auto/v3-discussions-discussion.yaml

@@ -312,7 +312,7 @@ patch:
               enum:
                 - error
                 - warning
-                - info
+                - suggestion
                 - urgent
                 - normal
             pos_start:

+ 2 - 2
openapi/public/assets/protocol/resources/auto/v3-discussions.yaml

@@ -184,7 +184,7 @@ post:
   operationId: post_api_v3_discussions
   description: |-
     discussion / issue 登录即可发;qa / help 只能发在文章上,且只有文章的编辑者能发。
-    severity 的取值随 type:issue 为 error / warning / info,help 为 urgent / normal,
+    severity 的取值随 type:issue 为 error / warning / suggestion,help 为 urgent / normal,
     其它类型不收。默认会通知对象的作者(站内信 + webhook),`notify=false` 关闭。
     批注(note / commentary)只能加在句子上,且只有该句所在 channel 的编辑者能加;
     标题可省、正文必填,commentary 的正文必须是义注句子模板 `{{book-para-start-end}}`
@@ -236,7 +236,7 @@ post:
               enum:
                 - error
                 - warning
-                - info
+                - suggestion
                 - urgent
                 - normal
             pos_start: