@@ -792,21 +792,25 @@ export function formatChannelProgressDraftText(params: {
|
792 | 792 | const maxLines = resolveChannelProgressDraftMaxLines(params.entry); |
793 | 793 | const formatLine = params.formatLine ?? ((line: string) => line); |
794 | 794 | const bullet = params.bullet ?? "•"; |
795 | | -const progressLines = params.lines |
| 795 | +const rawLines: Array<string | ChannelProgressDraftLine | { draftLabel: string }> = label |
| 796 | + ? [{ draftLabel: label }, ...params.lines] |
| 797 | + : params.lines; |
| 798 | +const lines = rawLines |
796 | 799 | .map((line) => { |
797 | | -const rawText = typeof line === "string" ? line : getProgressDraftLineText(line); |
| 800 | +const isLabelLine = typeof line === "object" && line !== null && "draftLabel" in line; |
| 801 | +const rawText = isLabelLine |
| 802 | + ? line.draftLabel |
| 803 | + : typeof line === "string" |
| 804 | + ? line |
| 805 | + : getProgressDraftLineText(line); |
798 | 806 | const text = compactChannelProgressDraftLine(rawText, DEFAULT_PROGRESS_DRAFT_MAX_LINE_CHARS); |
799 | | -return text ? { text, isLabelLine: false } : undefined; |
| 807 | +return text ? { text, isLabelLine } : undefined; |
800 | 808 | }) |
801 | 809 | .filter((line): line is { text: string; isLabelLine: boolean } => Boolean(line)) |
802 | 810 | .slice(-maxLines) |
803 | | -.map(({ text }) => { |
804 | | -const formatted = formatLine(text); |
805 | | -return shouldPrefixProgressLine(text) ? `${bullet} ${formatted}` : formatted; |
| 811 | +.map(({ text, isLabelLine }) => { |
| 812 | +const formatted = isLabelLine ? text : formatLine(text); |
| 813 | +return !isLabelLine && shouldPrefixProgressLine(text) ? `${bullet} ${formatted}` : formatted; |
806 | 814 | }); |
807 | | -const labelLine = label |
808 | | - ? compactChannelProgressDraftLine(label, DEFAULT_PROGRESS_DRAFT_MAX_LINE_CHARS) |
809 | | - : ""; |
810 | | -const lines = [...(labelLine ? [labelLine] : []), ...progressLines]; |
811 | 815 | return lines.filter((line): line is string => Boolean(line)).join("\n"); |
812 | 816 | } |