fix: use ok:true wrapper for emojiList consistent with other actions

This commit is contained in:
Marcus Castro
2026-02-10 14:55:53 -03:00
committed by Peter Steinberger
parent 36ec13a593
commit 475299346a

View File

@@ -312,18 +312,17 @@ export async function handleSlackAction(
throw new Error("Slack emoji list is disabled.");
}
const result = readOpts ? await listSlackEmojis(readOpts) : await listSlackEmojis();
const ok = result.ok ?? false;
const limit = readNumberParam(params, "limit", { integer: true });
if (limit != null && limit > 0 && result.emoji != null) {
const entries = Object.entries(result.emoji).toSorted(([a], [b]) => a.localeCompare(b));
if (entries.length > limit) {
return jsonResult({
ok,
ok: true,
emojis: { ...result, emoji: Object.fromEntries(entries.slice(0, limit)) },
});
}
}
return jsonResult({ ok, emojis: result });
return jsonResult({ ok: true, emojis: result });
}
throw new Error(`Unknown action: ${action}`);