decord/source/modules/rpc/helpers/validateOpenInviteDialog.tsx
github-actions 7450227d0b chore: update source for alpha 345.4
Skipped 1 file(s) >100MB (GitHub limit): source/__vendor/09xxx/9596_m.js (380.6 MB)
2026-09-04 17:41:35 +00:00

87 lines
3.4 KiB
TypeScript

// Module ID: 14405
// Function ID: 14406
// Name: validateOpenInviteDialog
// Dependencies: [9439, 1386, 1908, 4120, 4383, 673, 9440, 9483, 14393, 9703, 2]
// Exports: validateOpenInviteDialog
// Module 14405 (validateOpenInviteDialog)
import prototypeDefault from "prototype" /* 9483 */;
import canViewInviteModal from "canViewInviteModal" /* 9703 */;
import getCurrentEmbeddedActivityChannelDefault from "getCurrentEmbeddedActivityChannel" /* 14393 */;
import closure_3 from "map" /* 9439 */;
import closure_4 from "ensureGuildLoaded" /* 1386 */;
import closure_5 from "createGuildRecordFromRust" /* 1908 */;
import closure_6 from "getUncachedChannelPermissions" /* 4120 */;
import { TransportTypes } from "RPC_SCOPE_CONFIG" /* 4383 */;
import { RPCErrors } from "ME" /* 673 */;
import FrameLayoutModes from "FrameLayoutModes" /* 9440 */;
require = arg1;
({ asLaunched: c9, EmbeddedSurfaceType: c10 } = FrameLayoutModes);
const result = require("set").fileFinishedImporting("modules/rpc/helpers/validateOpenInviteDialog.tsx");
export const validateOpenInviteDialog = function validateOpenInviteDialog(socket) {
if (socket.source.type !== TransportTypes.POST_MESSAGE) {
let obj = { errorCode: null };
obj[0] = RPCErrors.INVALID_COMMAND;
const _HermesInternal3 = HermesInternal;
let tmp36 = prototypeDefault;
tmp36 = new tmp36(obj, "command not available from \"" + socket.source.type + "\" transport");
throw tmp36;
} else {
const tmp46 = callback(frameByIframeId.getFrameByIframeId(socket.source.iframeId));
if (null != tmp46) {
const surface = tmp46.surface;
const type = surface.type;
if (constants.MAIN === type) {
obj = { frame: null, channel: "Array", guild: "context" };
obj[0] = tmp46;
return obj;
} else if (tmp23.APP_CHANNEL === type) {
obj1 = { frame: null, channel: null, guild: null };
obj1[0] = tmp46;
obj1[1] = channel.getChannel(surface.channelId);
obj1[2] = store.getGuild(surface.guildId);
return obj1;
} else {
const obj2 = { errorCode: null };
obj2[0] = RPCErrors.INVALID_CHANNEL;
const tmp30 = new prototypeDefault(obj2, "Invalid channel");
throw tmp30;
}
} else {
const obj9 = getCurrentEmbeddedActivityChannelDefault();
if (null == obj9) {
const obj3 = { errorCode: null };
obj3[0] = RPCErrors.INVALID_CHANNEL;
const tmp21 = new tmp48(9483)(obj3, "Invalid channel");
throw tmp21;
} else {
const guild = store.getGuild(obj9.getGuildId());
if (null == guild) {
const obj4 = { errorCode: null };
obj4[0] = RPCErrors.INVALID_CHANNEL;
let tmp48Result = tmp48(9483);
const _HermesInternal2 = HermesInternal;
tmp48Result = new tmp48Result(obj4, "Invalid guild " + obj9.getGuildId());
throw tmp48Result;
} else {
if (obj10.canViewInviteModal(closure_6, guild, obj9)) {
const obj5 = { frame: "r", channel: null, guild: null };
obj5[1] = obj9;
obj5[2] = guild;
return obj5;
} else {
obj = { errorCode: null };
obj[0] = RPCErrors.INVALID_PERMISSIONS;
const _HermesInternal = HermesInternal;
let tmp = tmp48(9483);
tmp = new tmp(obj, "No invite permissions for " + obj9.id);
throw tmp;
}
obj10 = canViewInviteModal;
}
}
}
}
};