decord/source/modules/rpc/helpers/validateOpenInviteDialog.tsx
github-actions 67d978d9fb chore: update source for alpha 346.0
Skipped 1 file(s) >100MB (GitHub limit): source/__vendor/09xxx/9672_m.js (378.6 MB)
2026-09-07 16:44:02 +00:00

87 lines
3.5 KiB
TypeScript

// Module ID: 14483
// Function ID: 14484
// Name: validateOpenInviteDialog
// Dependencies: [9515, 1957, 1979, 4199, 4465, 1074, 9516, 9559, 14471, 9779, 2]
// Exports: validateOpenInviteDialog
// Module 14483 (validateOpenInviteDialog)
import prototypeDefault from "prototype" /* 9559 */;
import canViewInviteModal from "canViewInviteModal" /* 9779 */;
import getCurrentEmbeddedActivityChannelDefault from "getCurrentEmbeddedActivityChannel" /* 14471 */;
import closure_3 from "map" /* 9515 */;
import closure_4 from "ensureGuildLoaded" /* 1957 */;
import closure_5 from "createGuildRecordFromRust" /* 1979 */;
import closure_6 from "getUncachedChannelPermissions" /* 4199 */;
import { TransportTypes } from "RPC_SCOPE_CONFIG" /* 4465 */;
import { RPCErrors } from "ME" /* 1074 */;
import FrameLayoutModes from "FrameLayoutModes" /* 9516 */;
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: "options" };
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(9559)(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(9559);
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: "flexDirection", 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(9559);
tmp = new tmp(obj, "No invite permissions for " + obj9.id);
throw tmp;
}
obj10 = canViewInviteModal;
}
}
}
}
};