refactor: share inbound envelope label helper
This commit is contained in:
@@ -8,7 +8,7 @@ import {
|
||||
type ResponsePrefixContext,
|
||||
} from "../../auto-reply/reply/response-prefix-template.js";
|
||||
import { hasControlCommand } from "../../auto-reply/command-detection.js";
|
||||
import { formatInboundEnvelope } from "../../auto-reply/envelope.js";
|
||||
import { formatInboundEnvelope, formatInboundFromLabel } from "../../auto-reply/envelope.js";
|
||||
import {
|
||||
createInboundDebouncer,
|
||||
resolveInboundDebounceMs,
|
||||
@@ -65,13 +65,14 @@ export function createSignalEventHandler(deps: SignalEventHandlerDeps) {
|
||||
};
|
||||
|
||||
async function handleSignalInboundMessage(entry: SignalInboundEntry) {
|
||||
// For groups: use group name or just "Group" (channel "Signal" is already shown).
|
||||
// For DMs: keep headers compact; only add id: suffix if display differs from name.
|
||||
const fromLabel = entry.isGroup
|
||||
? `${entry.groupName || "Group"} id:${entry.groupId}`
|
||||
: entry.senderName === entry.senderDisplay
|
||||
? entry.senderName
|
||||
: `${entry.senderName} id:${entry.senderDisplay}`;
|
||||
const fromLabel = formatInboundFromLabel({
|
||||
isGroup: entry.isGroup,
|
||||
groupLabel: entry.groupName ?? undefined,
|
||||
groupId: entry.groupId ?? "unknown",
|
||||
groupFallback: "Group",
|
||||
directLabel: entry.senderName,
|
||||
directId: entry.senderDisplay,
|
||||
});
|
||||
const body = formatInboundEnvelope({
|
||||
channel: "Signal",
|
||||
from: fromLabel,
|
||||
|
||||
Reference in New Issue
Block a user