decord/source/modules/rpc/helpers/validateOpenInviteDialog.tsx

88 lines
3.5 KiB
TypeScript
Raw Normal View History

2026-08-31 15:47:37 +00:00
// Module ID: 14101
// Function ID: 14102
2026-07-20 16:05:17 +00:00
// Name: validateOpenInviteDialog
2026-08-31 15:47:37 +00:00
// Dependencies: [9425, 1387, 1909, 4091, 4350, 676, 9426, 9464, 14089, 9704, 2]
2026-07-20 16:05:17 +00:00
// Exports: validateOpenInviteDialog
2026-08-31 15:47:37 +00:00
// Module 14101 (validateOpenInviteDialog)
import prototypeDefault from "prototype" /* 9464 */;
import canViewInviteModal from "canViewInviteModal" /* 9704 */;
import getCurrentEmbeddedActivityChannelDefault from "getCurrentEmbeddedActivityChannel" /* 14089 */;
import closure_3 from "map" /* 9425 */;
import closure_4 from "ensureGuildLoaded" /* 1387 */;
import closure_5 from "createGuildRecordFromRust" /* 1909 */;
import closure_6 from "getUncachedChannelPermissions" /* 4091 */;
import { TransportTypes } from "RPC_SCOPE_CONFIG" /* 4350 */;
2026-08-24 06:08:38 +00:00
import { RPCErrors } from "ME" /* 676 */;
2026-08-31 15:47:37 +00:00
import FrameLayoutModes from "FrameLayoutModes" /* 9426 */;
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
require = arg1;
2026-08-07 06:50:47 +00:00
({ asLaunched: c9, EmbeddedSurfaceType: c10 } = FrameLayoutModes);
2026-08-24 06:08:38 +00:00
const result = require("set").fileFinishedImporting("modules/rpc/helpers/validateOpenInviteDialog.tsx");
2026-07-20 16:05:17 +00:00
2026-08-07 06:50:47 +00:00
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;
2026-08-24 06:08:38 +00:00
let tmp36 = prototypeDefault;
2026-08-07 06:50:47 +00:00
tmp36 = new tmp36(obj, "command not available from \"" + socket.source.type + "\" transport");
throw tmp36;
2026-07-20 16:05:17 +00:00
} else {
2026-08-07 06:50:47 +00:00
const tmp46 = callback(frameByIframeId.getFrameByIframeId(socket.source.iframeId));
if (null != tmp46) {
const surface = tmp46.surface;
const type = surface.type;
if (constants.MAIN === type) {
2026-08-31 15:47:37 +00:00
obj = { frame: null, channel: "Array", guild: "accessibilityLabel" };
2026-08-07 06:50:47 +00:00
obj[0] = tmp46;
return obj;
} else if (tmp23.APP_CHANNEL === type) {
2026-08-24 06:08:38 +00:00
obj1 = { frame: null, channel: null, guild: null };
2026-08-07 06:50:47 +00:00
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;
2026-08-24 06:08:38 +00:00
const tmp30 = new prototypeDefault(obj2, "Invalid channel");
2026-08-07 06:50:47 +00:00
throw tmp30;
}
2026-07-20 16:05:17 +00:00
} else {
2026-08-24 06:08:38 +00:00
const obj9 = getCurrentEmbeddedActivityChannelDefault();
2026-08-07 06:50:47 +00:00
if (null == obj9) {
const obj3 = { errorCode: null };
obj3[0] = RPCErrors.INVALID_CHANNEL;
2026-08-31 15:47:37 +00:00
const tmp21 = new tmp48(9464)(obj3, "Invalid channel");
2026-08-07 06:50:47 +00:00
throw tmp21;
2026-07-20 16:05:17 +00:00
} else {
2026-08-07 06:50:47 +00:00
const guild = store.getGuild(obj9.getGuildId());
if (null == guild) {
const obj4 = { errorCode: null };
obj4[0] = RPCErrors.INVALID_CHANNEL;
2026-08-31 15:47:37 +00:00
let tmp48Result = tmp48(9464);
2026-08-07 06:50:47 +00:00
const _HermesInternal2 = HermesInternal;
tmp48Result = new tmp48Result(obj4, "Invalid guild " + obj9.getGuildId());
throw tmp48Result;
2026-07-20 16:05:17 +00:00
} else {
2026-08-24 06:08:38 +00:00
if (obj10.canViewInviteModal(closure_6, guild, obj9)) {
2026-08-31 15:47:37 +00:00
const obj5 = { frame: "r", channel: "PX_16", guild: null };
2026-08-07 06:50:47 +00:00
obj5[1] = obj9;
obj5[2] = guild;
return obj5;
} else {
obj = { errorCode: null };
obj[0] = RPCErrors.INVALID_PERMISSIONS;
const _HermesInternal = HermesInternal;
2026-08-31 15:47:37 +00:00
let tmp = tmp48(9464);
2026-08-07 06:50:47 +00:00
tmp = new tmp(obj, "No invite permissions for " + obj9.id);
throw tmp;
}
2026-08-24 06:08:38 +00:00
obj10 = canViewInviteModal;
2026-07-20 16:05:17 +00:00
}
}
}
}
};