style: oxfmt format

This commit is contained in:
Peter Steinberger
2026-01-17 05:48:34 +00:00
parent 8b42902cee
commit e59d8c5436
47 changed files with 152 additions and 165 deletions

View File

@@ -20,13 +20,20 @@ describe("resolveConversationLabel", () => {
});
it("does not append ids for #rooms/channels", () => {
const ctx: MsgContext = { ChatType: "channel", GroupSubject: "#general", From: "slack:channel:C123" };
const ctx: MsgContext = {
ChatType: "channel",
GroupSubject: "#general",
From: "slack:channel:C123",
};
expect(resolveConversationLabel(ctx)).toBe("#general");
});
it("appends ids for WhatsApp-like group ids when a subject exists", () => {
const ctx: MsgContext = { ChatType: "group", GroupSubject: "Family", From: "whatsapp:group:123@g.us" };
const ctx: MsgContext = {
ChatType: "group",
GroupSubject: "Family",
From: "whatsapp:group:123@g.us",
};
expect(resolveConversationLabel(ctx)).toBe("Family id:123@g.us");
});
});

View File

@@ -43,4 +43,3 @@ export function resolveConversationLabel(ctx: MsgContext): string | undefined {
if (base.startsWith("#") || base.startsWith("@")) return base;
return `${base} id:${id}`;
}

View File

@@ -53,10 +53,7 @@ export const whatsappOutbound: ChannelOutboundAdapter = {
}
return {
ok: false,
error: missingTargetError(
"WhatsApp",
"<E.164|group JID> or channels.whatsapp.allowFrom[0]",
),
error: missingTargetError("WhatsApp", "<E.164|group JID> or channels.whatsapp.allowFrom[0]"),
};
},
sendText: async ({ to, text, accountId, deps, gifPlayback }) => {

View File

@@ -202,10 +202,7 @@ export const signalPlugin: ChannelPlugin<ResolvedSignalAccount> = {
if (!trimmed) {
return {
ok: false,
error: missingTargetError(
"Signal",
"<E.164|group:ID|signal:group:ID|signal:+E.164>",
),
error: missingTargetError("Signal", "<E.164|group:ID|signal:group:ID|signal:+E.164>"),
};
}
return { ok: true, to: trimmed };

View File

@@ -342,7 +342,10 @@ export const whatsappPlugin: ChannelPlugin<ResolvedWhatsAppAccount> = {
}
return {
ok: false,
error: missingTargetError("WhatsApp", "<E.164|group JID> or channels.whatsapp.allowFrom[0]"),
error: missingTargetError(
"WhatsApp",
"<E.164|group JID> or channels.whatsapp.allowFrom[0]",
),
};
},
sendText: async ({ to, text, accountId, deps, gifPlayback }) => {

View File

@@ -11,7 +11,9 @@ describe("validateSenderIdentity", () => {
it("requires some sender identity for non-direct chats", () => {
const ctx: MsgContext = { ChatType: "group" };
expect(validateSenderIdentity(ctx)).toContain("missing sender identity (SenderId/SenderName/SenderUsername/SenderE164)");
expect(validateSenderIdentity(ctx)).toContain(
"missing sender identity (SenderId/SenderName/SenderUsername/SenderE164)",
);
});
it("validates SenderE164 and SenderUsername shape", () => {
@@ -27,4 +29,3 @@ describe("validateSenderIdentity", () => {
]);
});
});

View File

@@ -25,8 +25,10 @@ export function validateSenderIdentity(ctx: MsgContext): string[] {
}
if (senderUsername) {
if (senderUsername.includes("@")) issues.push(`SenderUsername should not include "@": ${senderUsername}`);
if (/\s/.test(senderUsername)) issues.push(`SenderUsername should not include whitespace: ${senderUsername}`);
if (senderUsername.includes("@"))
issues.push(`SenderUsername should not include "@": ${senderUsername}`);
if (/\s/.test(senderUsername))
issues.push(`SenderUsername should not include whitespace: ${senderUsername}`);
}
if (ctx.SenderId != null && !senderId) {
@@ -35,4 +37,3 @@ export function validateSenderIdentity(ctx: MsgContext): string[] {
return issues;
}