mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-13 07:50:35 +00:00
chore: Enable "curly" rule to avoid single-statement if confusion/errors.
This commit is contained in:
@@ -23,13 +23,17 @@ export type SignalReactionResult = {
|
||||
|
||||
function normalizeSignalId(raw: string): string {
|
||||
const trimmed = raw.trim();
|
||||
if (!trimmed) return "";
|
||||
if (!trimmed) {
|
||||
return "";
|
||||
}
|
||||
return trimmed.replace(/^signal:/i, "").trim();
|
||||
}
|
||||
|
||||
function normalizeSignalUuid(raw: string): string {
|
||||
const trimmed = normalizeSignalId(raw);
|
||||
if (!trimmed) return "";
|
||||
if (!trimmed) {
|
||||
return "";
|
||||
}
|
||||
if (trimmed.toLowerCase().startsWith("uuid:")) {
|
||||
return trimmed.slice("uuid:".length).trim();
|
||||
}
|
||||
@@ -44,9 +48,13 @@ function resolveTargetAuthorParams(params: {
|
||||
const candidates = [params.targetAuthor, params.targetAuthorUuid, params.fallback];
|
||||
for (const candidate of candidates) {
|
||||
const raw = candidate?.trim();
|
||||
if (!raw) continue;
|
||||
if (!raw) {
|
||||
continue;
|
||||
}
|
||||
const normalized = normalizeSignalUuid(raw);
|
||||
if (normalized) return { targetAuthor: normalized };
|
||||
if (normalized) {
|
||||
return { targetAuthor: normalized };
|
||||
}
|
||||
}
|
||||
return {};
|
||||
}
|
||||
@@ -118,9 +126,15 @@ export async function sendReactionSignal(
|
||||
targetTimestamp,
|
||||
...targetAuthorParams,
|
||||
};
|
||||
if (normalizedRecipient) params.recipients = [normalizedRecipient];
|
||||
if (groupId) params.groupIds = [groupId];
|
||||
if (account) params.account = account;
|
||||
if (normalizedRecipient) {
|
||||
params.recipients = [normalizedRecipient];
|
||||
}
|
||||
if (groupId) {
|
||||
params.groupIds = [groupId];
|
||||
}
|
||||
if (account) {
|
||||
params.account = account;
|
||||
}
|
||||
|
||||
const result = await signalRpcRequest<{ timestamp?: number }>("sendReaction", params, {
|
||||
baseUrl,
|
||||
@@ -179,9 +193,15 @@ export async function removeReactionSignal(
|
||||
remove: true,
|
||||
...targetAuthorParams,
|
||||
};
|
||||
if (normalizedRecipient) params.recipients = [normalizedRecipient];
|
||||
if (groupId) params.groupIds = [groupId];
|
||||
if (account) params.account = account;
|
||||
if (normalizedRecipient) {
|
||||
params.recipients = [normalizedRecipient];
|
||||
}
|
||||
if (groupId) {
|
||||
params.groupIds = [groupId];
|
||||
}
|
||||
if (account) {
|
||||
params.account = account;
|
||||
}
|
||||
|
||||
const result = await signalRpcRequest<{ timestamp?: number }>("sendReaction", params, {
|
||||
baseUrl,
|
||||
|
||||
Reference in New Issue
Block a user