- scam/fake: enforce mutual exclusivity (scam precedence) at TL conversion, admin command, and UI toggles; both flags could render as neither - scam/fake flicker: persist scam/fake in the Redis user base cache so cache hits no longer drop the flags - getSavedStarGifts: hidden (unsaved) gifts are now force-excluded for non-owner viewers; same guard for get-by-ref - convertStarGift: map already-upgraded/owner-invalid/unavailable to a clean client error instead of 500 - channel force-settings: send only changed fields (partial patch) and re-sync toggles after reload, so one setting no longer resets another - give gifts: removed custom collectible numbers (auto sequential only); locked sender to the system account 777000 - give gifts UI: fixed picker card spacing/right gap; static (hover-play) Lottie previews on emoji + picker to stop render lag; fixed emoji ID field overflow
59 lines
1.6 KiB
TypeScript
59 lines
1.6 KiB
TypeScript
import { ShieldAlert, ShieldX } from "lucide-react";
|
|
import { useI18n } from "../i18n";
|
|
import { ActionButton } from "./ActionButton";
|
|
import { Badge } from "./ui";
|
|
|
|
// ScamFakeBadges renders the SCAM/FAKE moderation labels when set.
|
|
export function ScamFakeBadges({ scam, fake }: { scam: boolean; fake: boolean }) {
|
|
const { t } = useI18n();
|
|
if (!scam && !fake) {
|
|
return null;
|
|
}
|
|
return (
|
|
<>
|
|
{scam && <Badge tone="danger">{t("flags.scam")}</Badge>}
|
|
{fake && <Badge tone="danger">{t("flags.fake")}</Badge>}
|
|
</>
|
|
);
|
|
}
|
|
|
|
// ScamFakeActions renders the two toggles. scam and fake are mutually exclusive
|
|
// (a peer is never both in Telegram), so enabling one clears the other; the
|
|
// combined setter always receives the full desired state.
|
|
export function ScamFakeActions({
|
|
idKey,
|
|
id,
|
|
path,
|
|
scam,
|
|
fake,
|
|
onDone
|
|
}: {
|
|
idKey: "user_id" | "channel_id";
|
|
id: number;
|
|
path: string;
|
|
scam: boolean;
|
|
fake: boolean;
|
|
onDone: () => void;
|
|
}) {
|
|
const { t } = useI18n();
|
|
return (
|
|
<div className="action-stack">
|
|
<ActionButton
|
|
label={scam ? t("flags.clearScam") : t("flags.setScam")}
|
|
icon={<ShieldAlert size={15} />}
|
|
tone="danger"
|
|
path={path}
|
|
payload={() => ({ [idKey]: id, scam: !scam, fake: !scam ? false : fake })}
|
|
onDone={onDone}
|
|
/>
|
|
<ActionButton
|
|
label={fake ? t("flags.clearFake") : t("flags.setFake")}
|
|
icon={<ShieldX size={15} />}
|
|
tone="danger"
|
|
path={path}
|
|
payload={() => ({ [idKey]: id, fake: !fake, scam: !fake ? false : scam })}
|
|
onDone={onDone}
|
|
/>
|
|
</div>
|
|
);
|
|
}
|