// Metro module 11021 (f11022). import GuildStore from "../../stores/GuildStore"; import { DEFAULT_LOCKDOWN_DURATION } from "./GuildAntiRaidConstants"; import { AnalyticEvents, Endpoints, GuildFeatures } from "../../Constants"; import AnalyticsUtils from "../../utils/AnalyticsUtils"; import { collectGuildAnalyticsMetadata } from "../app_analytics/AppAnalyticsUtils"; import GuildSettingsActionCreators from "../guild_settings/GuildSettingsActionCreators"; import Module3771 from "../../_bundle/Module3771"; import { HTTP, rejectWithMigratedError } from "../../_bundle/sendRequest"; import getGuildSafetyAlertsChannelId from "./getGuildSafetyAlertsChannelId"; export function trackReportRaidViewed(a0, raid_types = []) { if (raid_types.length !== 0) { AnalyticsUtils.track(AnalyticEvents.GUILD_RAID_REPORTED, { ...collectGuildAnalyticsMetadata(a0), guild_id: a0, raid_types }); } } export async function setGuildRaidAlerts(c26908_0, c26908_1) { const set = new Set(c26908_0.features); if (set.has(GuildFeatures.COMMUNITY)) { if (c26908_1) { set.delete(GuildFeatures.RAID_ALERTS_DISABLED); } else { set.add(GuildFeatures.RAID_ALERTS_DISABLED); } } else if (c26908_1) { set.add(GuildFeatures.NON_COMMUNITY_RAID_ALERTS); } else { set.delete(GuildFeatures.NON_COMMUNITY_RAID_ALERTS); } await GuildSettingsActionCreators.saveGuild(c26908_0.id, { features: set }, { throwErr: true }); } export async function setGuildIncidentActions(c26909_0, c26909_1, c26909_2, c26909_3) { const r11 = c26909_1 || c26909_2; let DEFAULT_LOCKDOWN_DURATION2 = c26909_3; if (c26909_3 == null) { DEFAULT_LOCKDOWN_DURATION2 = DEFAULT_LOCKDOWN_DURATION; } const r31 = DEFAULT_LOCKDOWN_DURATION2; const r13 = r11 ? Module3771().add(r31, "hours").toISOString() : null; const body = { invites_disabled_until: c26909_1 ? r13 : null, dms_disabled_until: c26909_2 ? r13 : null, lockdown_duration_hours: r11 ? r31 : null }; return await HTTP.put({ url: Endpoints.GUILD_INCIDENT_ACTIONS(c26909_0), body, rejectWithError: rejectWithMigratedError() }); } export async function handleResolveRaid(c26910_0, alert_message_id, reason) { let r33; L13: { const guild = GuildStore.getGuild(c26910_0); const r32 = (guild != null ? getGuildSafetyAlertsChannelId(guild) : null) == null; r33 = null; if (r32) { break L13; } return await HTTP.post({ url: Endpoints.GUILD_INCIDENT_REPORT_FALSE_ALARM(c26910_0), body: { alert_message_id, reason }, rejectWithError: rejectWithMigratedError() }); } return r33; } export async function handleReportRaid(c26911_0) { let r31; L13: { const guild = GuildStore.getGuild(c26911_0); const r30 = (guild != null ? getGuildSafetyAlertsChannelId(guild) : null) == null; r31 = null; if (r30) { break L13; } return await HTTP.post({ url: Endpoints.GUILD_INCIDENT_REPORT_RAID(c26911_0), rejectWithError: rejectWithMigratedError() }); } return r31; }