Files
discord-decomp/modules/messages/validateJumpWithAlert.tsx
T
2026-11-01 12:12:55 +02:00

55 lines
1.8 KiB
TypeScript

// Metro module 9943 (f9944).
import ChannelStore from "../../stores/ChannelStore";
import PermissionStore from "../../stores/PermissionStore";
import RelationshipStore from "../../stores/RelationshipStore";
import { Permissions } from "../../Constants";
import AlertActionCreators from "../../actions/AlertActionCreators";
import { intl, t } from "../../intl/index.native";
import { isSpam } from "./isSpam";
export default function validateJumpWithAlert(a0, a1) {
if (RelationshipStore.isBlockedForMessage(a0)) {
AlertActionCreators.show({
title: intl.string(t["j7eA/g"]),
body: intl.formatToPlainString(t.dTNNgr, {
name: a0.author.username
}),
confirmText: intl.string(t.BddRzS)
});
return false;
}
if (RelationshipStore.isIgnoredForMessage(a0)) {
AlertActionCreators.show({
title: intl.string(t.XyWoKV),
body: intl.formatToPlainString(t["8t8doK"], {
name: a0.author.username
}),
confirmText: intl.string(t.BddRzS)
});
return false;
}
if (isSpam(a0)) {
const channel = ChannelStore.getChannel(a0.channel_id);
if (!(channel == null ? void 0 : channel.isPrivate()) && !PermissionStore.can(Permissions.MODERATE_MEMBERS, channel)) {
AlertActionCreators.show({
title: intl.string(t["6vJKFk"]),
body: intl.formatToPlainString(t.zKNgPF, {
name: a0.author.username
}),
confirmText: intl.string(t.BddRzS)
});
} else {
AlertActionCreators.show({
title: intl.string(t["cZcG+P"]),
body: intl.formatToPlainString(t["1YTWty"], {
name: a0.author.username
}),
confirmText: intl.string(t["+TSRGD"]),
cancelText: intl.string(t["ETE/oC"]),
onConfirm: a1
});
}
return false;
}
return true;
};