870 lines
27 KiB
TypeScript
870 lines
27 KiB
TypeScript
// Metro module 5105 (f5106).
|
|
import BulkBanStore from "../modules/guild_mod_dash_member_safety/BulkBanStore";
|
|
import AuthenticationStore from "../stores/AuthenticationStore";
|
|
import ExpandedGuildFolderStore from "../stores/ExpandedGuildFolderStore";
|
|
import GuildChannelStore from "../stores/GuildChannelStore";
|
|
import GuildStore from "../stores/GuildStore";
|
|
import SelectedChannelStore from "../stores/SelectedChannelStore";
|
|
import SelectedGuildStore from "../stores/SelectedGuildStore";
|
|
import UserStore from "../stores/UserStore";
|
|
import { UserFlags, Endpoints, JoinGuildSources, Routes, AbortCodes, MAX_USER_GUILDS_PREMIUM, MAX_USER_GUILDS, AnalyticEvents } from "../Constants";
|
|
import { AgeGateSource } from "../modules/age_gate/AgeGateConstants";
|
|
import AlertActionCreators from "./AlertActionCreators";
|
|
import { intl, t } from "../intl/index.native";
|
|
import Dispatcher from "../Dispatcher";
|
|
import openQuarantineModeInfoModal_native from "../modules/quarantine/openQuarantineModeInfoModal.native";
|
|
import { rejectWithMigratedError, HTTP } from "../_bundle/sendRequest";
|
|
import { transitionTo } from "../modules/routing/router_utils";
|
|
import "../_bundle/asyncRequire";
|
|
import { openAgeGateModal } from "../modules/age_gate/AgeGateModalActionCreators";
|
|
import * as _GuildCapUpsellHooks from "../modules/premium/GuildCapUpsellHooks";
|
|
import { getChannelIdForGuildTransition } from "../modules/routing/getChannelIdForGuildTransition";
|
|
import safeTransitionTo_native from "../modules/links/safeTransitionTo.native";
|
|
import { stopLurking } from "../modules/lurker_mode/LurkerActionCreators";
|
|
import TrackedHTTPUtils from "../utils/TrackedHTTPUtils";
|
|
import { NetworkActionNames } from "../_bundle/Module503";
|
|
import BulkBanPubSubExperiment from "../modules/guild_mod_dash_member_safety/web/BulkBanPubSubExperiment";
|
|
import { NONE } from "../utils/PermissionUtils";
|
|
import { deserialize } from "../_bundle/HighLow";
|
|
import GuildTemplateTooltipActionCreators from "../modules/guild_templates/GuildTemplateTooltipActionCreators";
|
|
import V6OrEarlierAPIError from "../errors/V6OrEarlierAPIError";
|
|
import AnalyticsUtils from "../utils/AnalyticsUtils";
|
|
import getPreviousSafeRouteForNsfwReturn_native from "../modules/age_gate/getPreviousSafeRouteForNsfwReturn.native";
|
|
import { isChannelContentGated } from "../modules/age_gate/AgeGateUtils";
|
|
import { isChannelSpoilerGated } from "../modules/spoiler_channels/SpoilerChannelUtils";
|
|
function $mk114647($env) {
|
|
return () => {
|
|
const r4 = $env;
|
|
return Dispatcher.dispatch({
|
|
type: "GUILD_JOIN",
|
|
guildId: r4[0],
|
|
lurker: r4[7],
|
|
source: r4[2],
|
|
loadId: r4[3]
|
|
});
|
|
};
|
|
}
|
|
function $mk114648($env) {
|
|
return function showGuildAtCapacityAlert() {
|
|
AlertActionCreators.show({
|
|
title: intl.string(t.ZZlox4),
|
|
body: intl.string(t.ZUEGFn)
|
|
});
|
|
};
|
|
}
|
|
let deleteGuild, waitForGuild, _excluded;
|
|
let env3070 = {};
|
|
const showTooManyUserGuildsAlert = function showTooManyUserGuildsAlert(a0) {
|
|
AlertActionCreators.show({
|
|
title: intl.string(t.cTaRxF),
|
|
body: intl.formatToPlainString(t["VSd+Aj"], {
|
|
quantity: a0
|
|
})
|
|
});
|
|
};
|
|
deleteGuild = function deleteGuild(a0) {
|
|
Dispatcher.dispatch({
|
|
type: "GUILD_DELETE",
|
|
guild: {
|
|
id: a0
|
|
}
|
|
});
|
|
};
|
|
waitForGuild = function waitForGuild(c14622_0) {
|
|
return new Promise((c25333_0) => GuildStore.addConditionalChangeListener(() => {
|
|
const guild = GuildStore.getGuild(c14622_0);
|
|
let r8 = guild == null;
|
|
if (!r8) {
|
|
c25333_0(guild);
|
|
r8 = false;
|
|
}
|
|
return r8;
|
|
}));
|
|
};
|
|
_excluded = ["icon", "unicodeEmoji"];
|
|
const r52 = {
|
|
joinGuild: async function joinGuild(c25332_0, c25332_1) {
|
|
let r234, r273, promise;
|
|
let lurker, c25332_3, c25332_4, c25332_5;
|
|
let c25332_6 = 0;
|
|
const r15 = env3070;
|
|
L49: {
|
|
L48: {
|
|
L37: {
|
|
try {
|
|
let env29451;
|
|
c25332_4 = r15;
|
|
const r41 = env29451 = {
|
|
$parent: r15
|
|
};
|
|
c25332_3 = r41;
|
|
env29451[1] = void 0;
|
|
env29451[0] = c25332_0;
|
|
let r42 = c25332_1;
|
|
if (r42 === void 0) {
|
|
r42 = {};
|
|
}
|
|
env29451[1] = r42;
|
|
env29451[2] = void 0;
|
|
env29451[3] = void 0;
|
|
env29451[4] = void 0;
|
|
env29451[5] = void 0;
|
|
env29451[6] = void 0;
|
|
env29451[7] = void 0;
|
|
env29451[8] = void 0;
|
|
env29451[9] = void 0;
|
|
env29451[10] = void 0;
|
|
env29451[11] = void 0;
|
|
env29451[12] = void 0;
|
|
await void 0;
|
|
env29451[2] = env29451[1].source;
|
|
env29451[3] = env29451[1].loadId;
|
|
env29451[4] = env29451[1].lurkLocation;
|
|
env29451[5] = env29451[1].autoNavigate;
|
|
env29451[6] = env29451[5] === void 0 || env29451[5];
|
|
const lurker2 = env29451[1].lurker;
|
|
lurker = lurker2;
|
|
if (lurker2 == null) {
|
|
lurker = false;
|
|
}
|
|
env29451[7] = lurker;
|
|
env29451[8] = UserStore.getCurrentUser();
|
|
const r21 = env29451[8];
|
|
if (r21 == null ? void 0 : r21.hasFlag(UserFlags.QUARANTINED)) {
|
|
openQuarantineModeInfoModal_native();
|
|
promise = new Promise((resolve, reject) => reject(new Error()));
|
|
break L49;
|
|
}
|
|
Dispatcher.wait($mk114647(c25332_3));
|
|
c25332_6 = 1;
|
|
env29451[9] = SelectedGuildStore.getGuildId();
|
|
env29451[10] = env29451[0] === env29451[9] ? GuildStore.getGuild(env29451[0]) != null ? SelectedChannelStore.getChannelId(env29451[0]) : null : null;
|
|
const r125 = {
|
|
url: Endpoints.GUILD_JOIN(env29451[0]),
|
|
query: {
|
|
lurker: env29451[7],
|
|
session_id: env29451[7] ? AuthenticationStore.getSessionId() : null,
|
|
recommendation_load_id: env29451[3],
|
|
location: env29451[7] ? env29451[4] != null ? env29451[4] : null : null,
|
|
from_directory: env29451[2] === JoinGuildSources.DIRECTORY_ENTRY || null
|
|
},
|
|
context: {
|
|
source: env29451[2]
|
|
},
|
|
oldFormErrors: true,
|
|
body: {},
|
|
rejectWithError: rejectWithMigratedError()
|
|
};
|
|
env29451[11] = await HTTP.put(r125);
|
|
if (env29451[11].body.join_request != null) {
|
|
Dispatcher.dispatch({
|
|
type: "USER_GUILD_JOIN_REQUEST_UPDATE",
|
|
guildId: env29451[0],
|
|
request: env29451[11].body.join_request
|
|
});
|
|
}
|
|
if (GuildStore.getGuild(env29451[0]) == null && env29451[11].body.show_verification_form) {
|
|
if (env29451[6]) {
|
|
transitionTo(Routes.GUILD_MEMBER_VERIFICATION(env29451[0]));
|
|
r234 = env29451[11];
|
|
c25332_6 = 0;
|
|
break L37;
|
|
}
|
|
}
|
|
if (env29451[11].body.welcome_screen != null) {
|
|
Dispatcher.dispatch({
|
|
type: "WELCOME_SCREEN_UPDATE",
|
|
guildId: env29451[11].body.id,
|
|
welcomeScreen: env29451[11].body.welcome_screen
|
|
});
|
|
}
|
|
if (env29451[11].body.approximate_presence_count != null) {
|
|
Dispatcher.dispatch({
|
|
type: "ONLINE_GUILD_MEMBER_COUNT_UPDATE",
|
|
guildId: env29451[11].body.id,
|
|
count: env29451[11].body.approximate_presence_count
|
|
});
|
|
}
|
|
if (!env29451[7] && env29451[6]) {
|
|
env29451[12] = (await import("../modules/guild_onboarding/doGuildOnboarding.native")).default;
|
|
await (0, env29451[12])({
|
|
guildId: env29451[0],
|
|
returnChannelId: env29451[10]
|
|
});
|
|
}
|
|
r273 = env29451[11];
|
|
c25332_6 = 0;
|
|
break L48;
|
|
} catch ($e) {
|
|
const r39 = $e;
|
|
let r8 = r39;
|
|
c25332_5 = r39;
|
|
if (c25332_6 !== 0) {
|
|
while (true) {
|
|
try {
|
|
const r340 = c25332_5;
|
|
c25332_6 = 0;
|
|
env29451[13] = r340;
|
|
if (env29451[13].body?.code === AbortCodes.USER_GUILD_JOIN_LARGE_GUILD_UNDERAGE_DISALLOWED) {
|
|
openAgeGateModal(AgeGateSource.JOIN_LARGE_GUILD_UNDERAGE);
|
|
}
|
|
if (env29451[13].body?.code === AbortCodes.TOO_MANY_USER_GUILDS) {
|
|
const hasIncreasedGuildCap = _GuildCapUpsellHooks.hasIncreasedGuildCap(UserStore.getCurrentUser());
|
|
if (hasIncreasedGuildCap) {
|
|
showTooManyUserGuildsAlert(MAX_USER_GUILDS_PREMIUM);
|
|
} else {
|
|
showTooManyUserGuildsAlert(MAX_USER_GUILDS);
|
|
}
|
|
}
|
|
if (env29451[13].body?.code === AbortCodes.GUILD_AT_CAPACITY) {
|
|
$mk114648(env3070)();
|
|
}
|
|
if (env29451[7] && env29451[13].body?.code === AbortCodes.UNKNOWN_GUILD) {
|
|
(0, deleteGuild)(env29451[0]);
|
|
}
|
|
throw env29451[13];
|
|
} catch (r337) {
|
|
r8 = r337;
|
|
c25332_5 = r337;
|
|
if (c25332_6 === 0) {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
throw r8;
|
|
}
|
|
}
|
|
return r234;
|
|
}
|
|
return r273;
|
|
}
|
|
return promise;
|
|
},
|
|
waitForGuild,
|
|
transitionToGuildSync: async (c14623_0, c14623_1, c14623_2, c14623_3) => {
|
|
let welcomeModalChannelId, c25334_3;
|
|
let env29452;
|
|
c25334_3 = void 0;
|
|
const r12 = env29452 = {
|
|
$parent: env3070
|
|
};
|
|
let c25334_2 = r12;
|
|
env29452[0] = void 0;
|
|
env29452[1] = void 0;
|
|
const getChannelId2 = function getChannelId(a0, a1) {
|
|
return a1 == null ? getChannelIdForGuildTransition(a0) : a1;
|
|
};
|
|
env29452[0] = getChannelId2((await waitForGuild(c14623_0)).id, c14623_2);
|
|
env29452[1] = c14623_1;
|
|
if ((c14623_1 == null ? void 0 : c14623_1.hasOwnProperty("welcomeModalChannelId")) && c14623_1.welcomeModalChannelId == null) {
|
|
welcomeModalChannelId = env29452[0];
|
|
if (welcomeModalChannelId == null) {
|
|
welcomeModalChannelId = void 0;
|
|
}
|
|
env29452[1] = {
|
|
...c14623_1,
|
|
welcomeModalChannelId
|
|
};
|
|
}
|
|
safeTransitionTo_native(Routes.CHANNEL(c14623_0, env29452[0], c14623_3), env29452[1]);
|
|
await new Promise(setImmediate);
|
|
},
|
|
deleteGuild,
|
|
selectGuild: (a0) => {
|
|
stopLurking(a0);
|
|
},
|
|
createGuild: (a0) => {
|
|
Dispatcher.dispatch({
|
|
type: "GUILD_CREATE",
|
|
guild: a0
|
|
});
|
|
},
|
|
setServerMute: (a0, a1, a2) => HTTP.patch({
|
|
url: Endpoints.GUILD_MEMBER(a0, a1),
|
|
body: {
|
|
mute: a2
|
|
},
|
|
oldFormErrors: true,
|
|
rejectWithError: rejectWithMigratedError()
|
|
}),
|
|
setServerDeaf: (a0, a1, a2) => HTTP.patch({
|
|
url: Endpoints.GUILD_MEMBER(a0, a1),
|
|
body: {
|
|
deaf: a2
|
|
},
|
|
oldFormErrors: true,
|
|
rejectWithError: rejectWithMigratedError()
|
|
}),
|
|
setChannel: (a0, a1, a2) => {
|
|
HTTP.patch({
|
|
url: Endpoints.GUILD_MEMBER(a0, a1),
|
|
body: {
|
|
channel_id: a2
|
|
},
|
|
oldFormErrors: true,
|
|
rejectWithError: true
|
|
});
|
|
},
|
|
setMemberFlags: (a0, a1, a2) => {
|
|
HTTP.patch({
|
|
url: Endpoints.GUILD_MEMBER(a0, a1),
|
|
body: {
|
|
flags: a2
|
|
},
|
|
oldFormErrors: true,
|
|
rejectWithError: true
|
|
});
|
|
},
|
|
kickUser: (a0, a1, a2, a3) => {
|
|
const guildId = a0;
|
|
const userId = a1;
|
|
return HTTP.del({
|
|
url: Endpoints.GUILD_MEMBER(a0, a1),
|
|
query: {
|
|
reason: a2,
|
|
moderator_report_id: a3
|
|
},
|
|
oldFormErrors: true,
|
|
rejectWithError: rejectWithMigratedError()
|
|
}).then(() => {
|
|
Dispatcher.dispatch({
|
|
type: "GUILD_MEMBER_REMOVE_LOCAL",
|
|
guildId,
|
|
userId
|
|
});
|
|
});
|
|
},
|
|
setCommunicationDisabledUntil: ({ guildId: guildId4, userId: userId2, communicationDisabledUntilTimestamp, duration, reason, location: location2, moderatorReportId }) => TrackedHTTPUtils.patch({
|
|
url: Endpoints.GUILD_MEMBER(guildId4, userId2),
|
|
reason,
|
|
body: {
|
|
communication_disabled_until: communicationDisabledUntilTimestamp,
|
|
moderator_report_id: moderatorReportId
|
|
},
|
|
oldFormErrors: true,
|
|
trackedActionData: {
|
|
event: NetworkActionNames.USER_COMMUNICATION_DISABLED_UPDATE,
|
|
properties: {
|
|
guild_id: guildId4,
|
|
target_user_id: userId2,
|
|
duration: duration ?? null,
|
|
reason: reason ?? null,
|
|
communication_disabled_until: communicationDisabledUntilTimestamp,
|
|
location: location2 ?? null
|
|
}
|
|
},
|
|
rejectWithError: rejectWithMigratedError()
|
|
}),
|
|
banUser: (a0, a1, a2, a3, a4) => HTTP.put({
|
|
url: Endpoints.GUILD_BAN(a0, a1),
|
|
reason: a3,
|
|
body: {
|
|
delete_message_seconds: a2,
|
|
moderator_report_id: a4
|
|
},
|
|
oldFormErrors: true,
|
|
rejectWithError: rejectWithMigratedError()
|
|
}),
|
|
unbanUser: (a0, a1) => HTTP.del({
|
|
url: Endpoints.GUILD_BAN(a0, a1),
|
|
oldFormErrors: true,
|
|
rejectWithError: rejectWithMigratedError()
|
|
}),
|
|
banMultipleUsers: function banMultipleUsers(a0, a1, a2, a3, r2 = false) {
|
|
return HTTP.post({
|
|
url: r2 ? Endpoints.BULK_GUILD_BAN_V2(a0) : Endpoints.BULK_GUILD_BAN(a0),
|
|
body: {
|
|
user_ids: a1,
|
|
delete_message_seconds: a2
|
|
},
|
|
reason: a3,
|
|
oldFormErrors: true,
|
|
rejectWithError: rejectWithMigratedError()
|
|
});
|
|
},
|
|
startBulkBan: async function startBulkBan(c14625_0, c14625_1, c14625_2, c14625_3) {
|
|
const _this = this;
|
|
let body3;
|
|
let c25335_4 = 0;
|
|
let c29453_0, c29453_1, c29453_2, c29453_3, c29453_4, c29453_5, c29453_6;
|
|
L24: {
|
|
L12: {
|
|
try {
|
|
c29453_0 = void 0;
|
|
c29453_1 = void 0;
|
|
c29453_2 = void 0;
|
|
c29453_3 = void 0;
|
|
c29453_4 = void 0;
|
|
c29453_5 = void 0;
|
|
c29453_6 = void 0;
|
|
const usePubSub = BulkBanPubSubExperiment.getConfig({
|
|
location: "startBulkBan"
|
|
}).usePubSub;
|
|
c29453_0 = usePubSub;
|
|
c25335_4 = 1;
|
|
c29453_1 = await _this.banMultipleUsers(c14625_0, c14625_1, c14625_2, c14625_3, usePubSub);
|
|
if (c29453_0) {
|
|
if (BulkBanStore.consumeCompletedBeforeStarted(c14625_0, AuthenticationStore.getId())) {
|
|
c25335_4 = 0;
|
|
break L12;
|
|
}
|
|
}
|
|
Dispatcher.dispatch({
|
|
type: "GUILD_BULK_BAN_STARTED",
|
|
guildId: c14625_0
|
|
});
|
|
if (!c29453_0) {
|
|
const body4 = c29453_1.body;
|
|
body3 = body4;
|
|
if (body4 == null) {
|
|
body3 = {};
|
|
}
|
|
c29453_2 = body3;
|
|
c29453_3 = c29453_2.banned_users;
|
|
c29453_4 = c29453_3 === void 0 ? [] : c29453_3;
|
|
c29453_5 = c29453_2.failed_users;
|
|
c29453_6 = c29453_5 === void 0 ? [] : c29453_5;
|
|
Dispatcher.dispatch({
|
|
type: "GUILD_BULK_BAN_UPDATE",
|
|
guildId: c14625_0,
|
|
bulkBan: {
|
|
bannedUsers: c29453_4,
|
|
failedUsers: c29453_6,
|
|
targetUserIds: c14625_1
|
|
}
|
|
});
|
|
}
|
|
c25335_4 = 0;
|
|
break L24;
|
|
} catch ($e) {
|
|
let r8 = $e;
|
|
if (c25335_4 !== 0) {
|
|
while (true) {
|
|
try {
|
|
c25335_4 = 0;
|
|
Dispatcher.dispatch({
|
|
type: "GUILD_BULK_BAN_FAILED",
|
|
guildId: c14625_0
|
|
});
|
|
break L24;
|
|
} catch ($e) {
|
|
r8 = $e;
|
|
if (c25335_4 === 0) {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
throw r8;
|
|
}
|
|
}
|
|
return void 0;
|
|
}
|
|
},
|
|
createRole: async function createRole(c14626_0, c14626_1, c14626_2, c14626_3, r8 = {}) {
|
|
let r121;
|
|
let skipSelect = r8.skipSelect;
|
|
if (skipSelect === void 0) {
|
|
skipSelect = false;
|
|
}
|
|
let c14626_4 = skipSelect;
|
|
let color, colors, primary_color, c25336_5;
|
|
let c25336_6 = 0;
|
|
let c29454_0, c29454_1, c29454_2;
|
|
try {
|
|
c29454_0 = void 0;
|
|
c29454_1 = void 0;
|
|
let name = c14626_1;
|
|
if (!(name != null && name !== "")) {
|
|
name = intl.string(t.QBMHvB);
|
|
}
|
|
color = c14626_2;
|
|
if (c14626_2 == null) {
|
|
color = 0;
|
|
}
|
|
colors = c14626_3;
|
|
if (c14626_3 == null) {
|
|
primary_color = c14626_2;
|
|
if (c14626_2 == null) {
|
|
primary_color = 0;
|
|
}
|
|
colors = {
|
|
primary_color,
|
|
secondary_color: null,
|
|
tertiary_color: null
|
|
};
|
|
}
|
|
const body4 = {
|
|
name,
|
|
color,
|
|
colors,
|
|
permissions: NONE
|
|
};
|
|
c25336_6 = 1;
|
|
c29454_0 = await HTTP.post({
|
|
url: Endpoints.GUILD_ROLES(c14626_0),
|
|
oldFormErrors: true,
|
|
body: body4,
|
|
rejectWithError: rejectWithMigratedError()
|
|
});
|
|
c29454_1 = c29454_0.body;
|
|
c29454_1.permissions = deserialize(c29454_1.permissions);
|
|
if (!c14626_4) {
|
|
Dispatcher.dispatch({
|
|
type: "GUILD_SETTINGS_ROLE_SELECT",
|
|
roleId: c29454_0.body.id,
|
|
role: c29454_1
|
|
});
|
|
}
|
|
GuildTemplateTooltipActionCreators.checkGuildTemplateDirty(c14626_0);
|
|
r121 = c29454_1;
|
|
c25336_6 = 0;
|
|
} catch ($e) {
|
|
const r38 = $e;
|
|
let r16 = r38;
|
|
c25336_5 = r38;
|
|
if (c25336_6 !== 0) {
|
|
while (true) {
|
|
try {
|
|
const r144 = c25336_5;
|
|
c25336_6 = 0;
|
|
c29454_2 = r144;
|
|
throw new V6OrEarlierAPIError(c29454_2);
|
|
} catch (r140) {
|
|
r16 = r140;
|
|
c25336_5 = r140;
|
|
if (c25336_6 === 0) {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
throw r16;
|
|
}
|
|
return r121;
|
|
},
|
|
updateRole: async (c14627_0, c14627_1, c14627_2) => {
|
|
let c25337_1;
|
|
c25337_1 = void 0;
|
|
const { icon, unicodeEmoji, ...rest } = c14627_2;
|
|
const icon2 = icon !== null ? (icon == null ? void 0 : icon.startsWith("data:")) ? icon : void 0 : icon;
|
|
let c29455_0 = await HTTP.patch({
|
|
url: Endpoints.GUILD_ROLE(c14627_0, c14627_1),
|
|
body: {
|
|
...rest,
|
|
icon: icon2,
|
|
unicode_emoji: unicodeEmoji
|
|
},
|
|
oldFormErrors: true,
|
|
rejectWithError: rejectWithMigratedError()
|
|
});
|
|
GuildTemplateTooltipActionCreators.checkGuildTemplateDirty(c14627_0);
|
|
return c29455_0;
|
|
},
|
|
updateRolePermissions: (a0, a1, a2) => HTTP.patch({
|
|
url: Endpoints.GUILD_ROLE(a0, a1),
|
|
body: {
|
|
permissions: a2
|
|
},
|
|
oldFormErrors: true,
|
|
rejectWithError: rejectWithMigratedError()
|
|
}),
|
|
deleteRole: (a0, a1) => {
|
|
HTTP.del({
|
|
url: Endpoints.GUILD_ROLE(a0, a1),
|
|
oldFormErrors: true,
|
|
rejectWithError: true
|
|
}).then(() => {
|
|
GuildTemplateTooltipActionCreators.checkGuildTemplateDirty(a0);
|
|
});
|
|
},
|
|
batchChannelUpdate: async (c14629_0, body) => {
|
|
let c25338_1;
|
|
c25338_1 = void 0;
|
|
let c29456_0 = await HTTP.patch({
|
|
url: Endpoints.GUILD_CHANNELS(c14629_0),
|
|
body,
|
|
oldFormErrors: true,
|
|
rejectWithError: rejectWithMigratedError()
|
|
});
|
|
GuildTemplateTooltipActionCreators.checkGuildTemplateDirty(c14629_0);
|
|
return c29456_0;
|
|
},
|
|
batchRoleUpdate: async (c14630_0, body2) => {
|
|
let c25339_1;
|
|
c25339_1 = void 0;
|
|
let c29457_0 = await HTTP.patch({
|
|
url: Endpoints.GUILD_ROLES(c14630_0),
|
|
body: body2,
|
|
oldFormErrors: true,
|
|
rejectWithError: rejectWithMigratedError()
|
|
});
|
|
GuildTemplateTooltipActionCreators.checkGuildTemplateDirty(c14630_0);
|
|
return c29457_0;
|
|
},
|
|
requestMembers: function requestMembers(a0, query2 = "", limit3 = 10, presences = true) {
|
|
return Dispatcher.dispatch({
|
|
type: "GUILD_MEMBERS_REQUEST",
|
|
guildIds: Array.isArray(a0) ? a0 : [a0],
|
|
query: query2,
|
|
limit: limit3,
|
|
presences
|
|
});
|
|
},
|
|
searchRecentMembers: (a0, a1) => {
|
|
const r2 = a1 == null ? {} : a1;
|
|
return Dispatcher.dispatch({
|
|
type: "GUILD_SEARCH_RECENT_MEMBERS",
|
|
guildId: a0,
|
|
query: r2.query,
|
|
continuationToken: r2.continuationToken
|
|
});
|
|
},
|
|
requestMembersById: function requestMembersById(a0, a1, presences = true) {
|
|
return Dispatcher.dispatch({
|
|
type: "GUILD_MEMBERS_REQUEST",
|
|
guildIds: Array.isArray(a0) ? a0 : [a0],
|
|
userIds: Array.isArray(a1) ? a1 : [a1],
|
|
presences
|
|
});
|
|
},
|
|
move: (a0, a1, a2, a3) => {
|
|
Dispatcher.dispatch({
|
|
type: "GUILD_MOVE",
|
|
fromIndex: a0,
|
|
toIndex: a1,
|
|
fromFolderIndex: a2,
|
|
toFolderIndex: a3
|
|
});
|
|
},
|
|
moveById: function moveById(a0, a1, moveToBelow = false, combine = false) {
|
|
if (a0 === a1) {
|
|
throw new Error(`GuildActionCreators.moveById: \`sourceId\` and \`targetId\` cannot be the same value: ${a0}`);
|
|
}
|
|
Dispatcher.dispatch({
|
|
type: "GUILD_MOVE_BY_ID",
|
|
sourceId: a0,
|
|
targetId: a1,
|
|
moveToBelow,
|
|
combine
|
|
});
|
|
},
|
|
createGuildFolderLocal: (a0, a1) => {
|
|
AnalyticsUtils.track(AnalyticEvents.GUILD_FOLDER_CREATED);
|
|
Dispatcher.dispatch({
|
|
type: "GUILD_FOLDER_CREATE_LOCAL",
|
|
sourceIds: a0,
|
|
name: a1
|
|
});
|
|
},
|
|
editGuildFolderLocal: (a0, a1, a2) => {
|
|
Dispatcher.dispatch({
|
|
type: "GUILD_FOLDER_EDIT_LOCAL",
|
|
targetId: a0,
|
|
sourceIds: a1,
|
|
name: a2
|
|
});
|
|
},
|
|
deleteGuildFolderLocal: (a0) => {
|
|
Dispatcher.dispatch({
|
|
type: "GUILD_FOLDER_DELETE_LOCAL",
|
|
targetId: a0
|
|
});
|
|
},
|
|
toggleGuildFolderExpand: (a0) => {
|
|
AnalyticsUtils.track(AnalyticEvents.GUILD_FOLDER_CLICKED, {
|
|
source: "sidebar",
|
|
action: ExpandedGuildFolderStore.isFolderExpanded(a0) ? "collapsed" : "expanded"
|
|
});
|
|
Dispatcher.dispatch({
|
|
type: "TOGGLE_GUILD_FOLDER_EXPAND",
|
|
folderId: a0
|
|
});
|
|
},
|
|
setGuildFolderExpanded: (a0, a1) => {
|
|
Dispatcher.dispatch({
|
|
type: "SET_GUILD_FOLDER_EXPANDED",
|
|
folderId: a0,
|
|
expanded: a1
|
|
});
|
|
},
|
|
collapseAllFolders: () => {
|
|
Dispatcher.dispatch({
|
|
type: "GUILD_FOLDER_COLLAPSE"
|
|
});
|
|
},
|
|
nsfwAgree: (a0) => {
|
|
Dispatcher.dispatch({
|
|
type: "GUILD_NSFW_AGREE",
|
|
guildId: a0
|
|
});
|
|
},
|
|
nsfwReturnToSafety: (a0) => {
|
|
L9: {
|
|
const previousSafeRouteForNsfwReturn_native = getPreviousSafeRouteForNsfwReturn_native(a0);
|
|
if (previousSafeRouteForNsfwReturn_native == null) {
|
|
if (a0 != null) {
|
|
const defaultChannel = GuildChannelStore.getDefaultChannel(a0);
|
|
if (defaultChannel != null) {
|
|
if (!isChannelContentGated(defaultChannel) && !isChannelSpoilerGated(defaultChannel)) {
|
|
transitionTo(Routes.CHANNEL(a0, defaultChannel.id));
|
|
break L9;
|
|
}
|
|
}
|
|
transitionTo(Routes.FRIENDS, {
|
|
navigationReplace: false,
|
|
openChannel: true
|
|
});
|
|
} else {
|
|
transitionTo(Routes.FRIENDS, {
|
|
navigationReplace: false,
|
|
openChannel: true
|
|
});
|
|
}
|
|
} else {
|
|
transitionTo(Routes.CHANNEL(previousSafeRouteForNsfwReturn_native.guildId, previousSafeRouteForNsfwReturn_native.channelId));
|
|
}
|
|
}
|
|
},
|
|
spoilerAgree: (a0) => {
|
|
Dispatcher.dispatch({
|
|
type: "CHANNEL_SPOILER_AGREE",
|
|
channelId: a0
|
|
});
|
|
},
|
|
clearSpoilerAgree: (a0) => {
|
|
Dispatcher.dispatch({
|
|
type: "CHANNEL_SPOILER_AGREE_CLEAR",
|
|
channelId: a0
|
|
});
|
|
},
|
|
escapeToDefaultChannel: (a0) => {
|
|
const defaultChannel = GuildChannelStore.getDefaultChannel(a0);
|
|
if (defaultChannel != null) {
|
|
transitionTo(Routes.CHANNEL(a0, defaultChannel.id));
|
|
} else {
|
|
transitionTo(Routes.FRIENDS);
|
|
}
|
|
},
|
|
fetchApplications: async (c14631_0, channel_id) => {
|
|
let c25340_1;
|
|
c25340_1 = void 0;
|
|
const r11 = {
|
|
url: Endpoints.GUILD_APPLICATIONS(c14631_0),
|
|
oldFormErrors: true,
|
|
rejectWithError: rejectWithMigratedError()
|
|
};
|
|
if (channel_id != null) {
|
|
r11.query = {
|
|
channel_id
|
|
};
|
|
}
|
|
let c29458_0 = (await HTTP.get(r11)).body;
|
|
Dispatcher.dispatch({
|
|
type: "GUILD_APPLICATIONS_FETCH_SUCCESS",
|
|
guildId: c14631_0,
|
|
applications: c29458_0
|
|
});
|
|
},
|
|
fetchGuildBansBatch: async function fetchGuildBansBatch(guildId2, r6 = 1000) {
|
|
const limit = r6;
|
|
let r5 = arguments[2];
|
|
if (r5 === void 0) {
|
|
r5 = null;
|
|
}
|
|
const after = r5;
|
|
const query2 = {
|
|
limit
|
|
};
|
|
if (after != null) {
|
|
query2.after = after;
|
|
}
|
|
await HTTP.get({
|
|
url: Endpoints.GUILD_BANS(guildId2),
|
|
oldFormErrors: true,
|
|
query: query2,
|
|
rejectWithError: rejectWithMigratedError()
|
|
}).then((result) => {
|
|
Dispatcher.dispatch({
|
|
type: "GUILD_SETTINGS_LOADED_BANS_BATCH",
|
|
bans: result.body,
|
|
guildId: guildId2
|
|
});
|
|
});
|
|
},
|
|
searchGuildBans: async function searchGuildBans(guildId3, query, user_ids, r4 = 10) {
|
|
const limit2 = r4;
|
|
const query2 = {
|
|
limit: limit2
|
|
};
|
|
if (user_ids != null && user_ids.length > 0) {
|
|
query2.user_ids = user_ids;
|
|
}
|
|
if (query != null && query.trim().length > 0) {
|
|
query2.query = query;
|
|
}
|
|
await HTTP.get({
|
|
url: Endpoints.GUILD_BANS_SEARCH(guildId3),
|
|
oldFormErrors: true,
|
|
query: query2,
|
|
rejectWithError: rejectWithMigratedError()
|
|
}).then((result) => {
|
|
Dispatcher.dispatch({
|
|
type: "GUILD_SETTINGS_LOADED_BANS_BATCH",
|
|
bans: result.body,
|
|
userIds: user_ids,
|
|
guildId: guildId3
|
|
});
|
|
});
|
|
},
|
|
fetchGuildBans: async (c14634_0) => {
|
|
await HTTP.get({
|
|
url: Endpoints.GUILD_BANS(c14634_0),
|
|
oldFormErrors: true,
|
|
rejectWithError: rejectWithMigratedError()
|
|
}).then((result) => {
|
|
Dispatcher.dispatch({
|
|
type: "GUILD_SETTINGS_LOADED_BANS",
|
|
bans: result.body
|
|
});
|
|
});
|
|
},
|
|
fetchGuildRoleConnectionsEligibility: (a0, a1) => {
|
|
const roleId = a1;
|
|
return HTTP.get({
|
|
url: Endpoints.GUILD_ROLE_CONNECTIONS_ELIGIBILITY(a0, a1),
|
|
oldFormErrors: true,
|
|
rejectWithError: rejectWithMigratedError()
|
|
}).then(({ body: body4 }) => {
|
|
Dispatcher.dispatch({
|
|
type: "GUILD_ROLE_CONNECTION_ELIGIBILITY_FETCH_SUCCESS",
|
|
roleId,
|
|
roleConnectionEligibility: body4
|
|
});
|
|
return body4;
|
|
});
|
|
},
|
|
assignGuildRoleConnection: async (c14636_0, c14636_1) => {
|
|
await HTTP.post({
|
|
url: Endpoints.GUILD_ROLE_CONNECTIONS_ASSIGN(c14636_0, c14636_1),
|
|
oldFormErrors: true,
|
|
rejectWithError: rejectWithMigratedError()
|
|
});
|
|
},
|
|
unassignGuildRoleConnection: async (c14637_0, c14637_1) => {
|
|
await HTTP.post({
|
|
url: Endpoints.GUILD_ROLE_CONNECTIONS_UNASSIGN(c14637_0, c14637_1),
|
|
oldFormErrors: true,
|
|
rejectWithError: rejectWithMigratedError()
|
|
});
|
|
},
|
|
getGuildRoleConnectionsConfigurations: async (c14638_0) => (await HTTP.get({
|
|
url: Endpoints.GUILD_ROLE_CONNECTIONS_CONFIGURATIONS(c14638_0),
|
|
oldFormErrors: true,
|
|
rejectWithError: rejectWithMigratedError()
|
|
})).body
|
|
};
|
|
export default r52;
|
|
export { waitForGuild };
|