Compare commits

...

1 Commits

Author SHA1 Message Date
Naiyuan Qing
b79e4f8300 fix(issues): state-specific trigger chip copy
Five chip states get distinct copy instead of sharing one sentence and a
vague "not this time":

- single, will trigger:  Starts working when sent (unchanged)
- single, skipped:       Won't be triggered
- several, k will fire:  {{count}} agents start working when sent —
  the count covers only non-suppressed agents; skipped ones read as the
  dimmed heads in the stack next to the number
- several, all skipped:  No agents will be triggered
- popover row state:     Skipped

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-10 17:21:52 +08:00
6 changed files with 44 additions and 16 deletions

View File

@@ -62,11 +62,11 @@ describe("CommentTriggerChips", () => {
);
const chip = screen.getByRole("button");
expect(chip).toHaveTextContent("not this time");
expect(chip).toHaveTextContent("Won't be triggered");
expect(chip).toHaveAttribute("aria-pressed", "true");
});
it("collapses several agents into a stack with the shared sentence", () => {
it("collapses several agents into a stack with an active count", () => {
renderWithI18n(
<CommentTriggerChips
agents={[walt, bob]}
@@ -75,10 +75,22 @@ describe("CommentTriggerChips", () => {
/>,
);
expect(screen.getByRole("button")).toHaveTextContent("Starts working when sent");
expect(screen.getByRole("button")).toHaveTextContent("2 agents start working when sent");
});
it("switches to the skip state when every agent is suppressed", () => {
it("counts only non-suppressed agents in the sentence", () => {
renderWithI18n(
<CommentTriggerChips
agents={[walt, bob]}
suppressedAgentIds={new Set(["agent-2"])}
onToggle={vi.fn()}
/>,
);
expect(screen.getByRole("button")).toHaveTextContent("1 agent starts working when sent");
});
it("switches to the none-will-trigger state when every agent is suppressed", () => {
renderWithI18n(
<CommentTriggerChips
agents={[walt, bob]}
@@ -87,7 +99,7 @@ describe("CommentTriggerChips", () => {
/>,
);
expect(screen.getByRole("button")).toHaveTextContent("not this time");
expect(screen.getByRole("button")).toHaveTextContent("No agents will be triggered");
});
it("opens the popover on click and toggles a row", () => {

View File

@@ -147,11 +147,13 @@ function SingleTriggerChip({
onToggle: (agentId: string) => void;
t: IssuesT;
}) {
const state = suppressed ? t(($) => $.comment.trigger_suppressed) : sourceLabel(agent.source, t);
const state = suppressed
? t(($) => $.comment.trigger_skipped_label)
: sourceLabel(agent.source, t);
// The avatar carries "who"; the sentence carries only condition + outcome,
// so it stays fixed-width and never truncates on long agent names.
const sentence = suppressed
? t(($) => $.comment.trigger_suppressed)
? t(($) => $.comment.trigger_wont_trigger)
: t(($) => $.comment.trigger_will_start);
return (
@@ -201,12 +203,13 @@ function MultiTriggerChip({
// Mirror AgentAvatarStack: ~30% overlap reads as "stacked" without
// obscuring the next avatar.
const overlap = Math.round(AVATAR_SIZE * 0.3);
// The avatar stack already shows who and how many — the sentence is the
// same fixed condition + outcome copy as the single chip.
// The avatar stack shows who; the sentence promises only what WILL happen,
// so the count covers non-suppressed agents — skipped ones read as the
// dimmed heads right next to the number.
const sentence =
activeCount === 0
? t(($) => $.comment.trigger_suppressed)
: t(($) => $.comment.trigger_will_start);
? t(($) => $.comment.trigger_none_will_trigger)
: t(($) => $.comment.trigger_will_start_count, { count: activeCount });
const popoverTrigger = (
<PopoverTrigger
@@ -270,7 +273,7 @@ function MultiTriggerChip({
{agents.map((agent) => {
const suppressed = suppressedAgentIds.has(agent.id);
const state = suppressed
? t(($) => $.comment.trigger_suppressed)
? t(($) => $.comment.trigger_skipped_label)
: sourceLabel(agent.source, t);
return (
<Tooltip key={agent.id}>

View File

@@ -279,12 +279,16 @@
"trigger_source_mention_agent": "@mention",
"trigger_source_mention_squad_leader": "squad",
"trigger_source_unknown": "trigger",
"trigger_suppressed": "not this time",
"trigger_skipped_label": "Skipped",
"trigger_wont_trigger": "Won't be triggered",
"trigger_none_will_trigger": "No agents will be triggered",
"trigger_reason_issue_assignee": "{{name}} is assigned here and will be notified by this comment.",
"trigger_reason_mention_agent": "{{name}} is mentioned in this comment.",
"trigger_reason_mention_squad_leader": "{{name}} leads a squad mentioned in this comment.",
"trigger_reason_unknown": "{{name}} will be triggered by this comment.",
"trigger_will_start": "Starts working when sent",
"trigger_will_start_count_one": "{{count}} agent starts working when sent",
"trigger_will_start_count_other": "{{count}} agents start working when sent",
"trigger_starts_now": "It will start working right away.",
"trigger_starts_when_online": "It is offline now and will start once online.",
"trigger_click_to_skip": "Click to skip triggering this time.",

View File

@@ -271,12 +271,15 @@
"trigger_source_mention_agent": "@メンション",
"trigger_source_mention_squad_leader": "Squad",
"trigger_source_unknown": "トリガー",
"trigger_suppressed": "今回は実行しない",
"trigger_skipped_label": "スキップ",
"trigger_wont_trigger": "トリガーされません",
"trigger_none_will_trigger": "いずれもトリガーされません",
"trigger_reason_issue_assignee": "{{name}} はこのイシューの担当で、このコメントで通知されます。",
"trigger_reason_mention_agent": "このコメントで {{name}} がメンションされています。",
"trigger_reason_mention_squad_leader": "{{name}} はメンションされた Squad のリーダーです。",
"trigger_reason_unknown": "このコメントで {{name}} がトリガーされます。",
"trigger_will_start": "送信後に作業を開始します",
"trigger_will_start_count_other": "送信後に {{count}} 体のエージェントが作業を開始します",
"trigger_starts_now": "すぐに作業を開始します。",
"trigger_starts_when_online": "現在オフラインのため、オンラインになり次第開始します。",
"trigger_click_to_skip": "クリックすると今回はトリガーされません。",

View File

@@ -279,12 +279,15 @@
"trigger_source_mention_agent": "@멘션",
"trigger_source_mention_squad_leader": "Squad",
"trigger_source_unknown": "트리거",
"trigger_suppressed": "이번에는 실행 안 함",
"trigger_skipped_label": "건너뜀",
"trigger_wont_trigger": "트리거되지 않습니다",
"trigger_none_will_trigger": "모두 트리거되지 않습니다",
"trigger_reason_issue_assignee": "{{name}}님은 이 이슈의 담당자이며 이 댓글로 알림을 받습니다.",
"trigger_reason_mention_agent": "이 댓글에서 {{name}}님을 멘션했습니다.",
"trigger_reason_mention_squad_leader": "{{name}}님은 멘션된 Squad의 리더입니다.",
"trigger_reason_unknown": "이 댓글로 {{name}}님이 트리거됩니다.",
"trigger_will_start": "전송 후 작업을 시작합니다",
"trigger_will_start_count_other": "전송 후 에이전트 {{count}}개가 작업을 시작합니다",
"trigger_starts_now": "바로 작업을 시작합니다.",
"trigger_starts_when_online": "현재 오프라인이며 온라인이 되면 시작합니다.",
"trigger_click_to_skip": "클릭하면 이번에는 트리거되지 않습니다.",

View File

@@ -276,12 +276,15 @@
"trigger_source_mention_agent": "@mention",
"trigger_source_mention_squad_leader": "squad",
"trigger_source_unknown": "将触发",
"trigger_suppressed": "本次不触发",
"trigger_skipped_label": "已跳过",
"trigger_wont_trigger": "不会触发",
"trigger_none_will_trigger": "全部不会触发",
"trigger_reason_issue_assignee": "{{name}} 是当前 issue 的 assignee这条评论会唤醒它。",
"trigger_reason_mention_agent": "这条评论 @ 了 {{name}}。",
"trigger_reason_mention_squad_leader": "{{name}} 是被 @ Squad 的 leader。",
"trigger_reason_unknown": "这条评论会触发 {{name}}。",
"trigger_will_start": "发送后开始工作",
"trigger_will_start_count_other": "发送后 {{count}} 个智能体开始工作",
"trigger_starts_now": "将立即开始工作。",
"trigger_starts_when_online": "当前离线,上线后开始。",
"trigger_click_to_skip": "点击后本次不触发。",