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

87 lines
3.3 KiB
TypeScript
Raw Normal View History

2026-08-14 17:33:39 +00:00
// Module ID: 13817
// Function ID: 13818
2026-07-20 16:05:17 +00:00
// Name: validateOpenInviteDialog
2026-08-14 17:33:39 +00:00
// Dependencies: [10582, 1391, 1910, 3989, 4245, 676, 10583, 10727, 13806, 9022, 2]
2026-07-20 16:05:17 +00:00
// Exports: validateOpenInviteDialog
2026-08-14 17:33:39 +00:00
// Module 13817 (validateOpenInviteDialog)
2026-07-29 08:29:29 +00:00
import map from "map";
2026-08-07 06:50:47 +00:00
import ensureGuildLoaded from "ensureGuildLoaded";
2026-07-29 08:29:29 +00:00
import createGuildRecordFromRust from "createGuildRecordFromRust";
import getUncachedChannelPermissions from "getUncachedChannelPermissions";
2026-08-07 06:50:47 +00:00
import { TransportTypes } from "RPC_SCOPE_CONFIG";
2026-07-23 10:11:24 +00:00
import { RPCErrors } from "ME";
2026-08-07 06:50:47 +00:00
import FrameLayoutModes from "FrameLayoutModes";
2026-07-23 10:11:24 +00:00
2026-08-07 06:50:47 +00:00
let c10;
let c9;
2026-07-23 10:11:24 +00:00
const require = arg1;
2026-08-07 06:50:47 +00:00
({ asLaunched: c9, EmbeddedSurfaceType: c10 } = FrameLayoutModes);
const result = require("createGuildRecordFromRust").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-14 17:33:39 +00:00
let tmp36 = importDefault(10727);
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-13 07:00:46 +00:00
obj = { frame: null, channel: "Array", guild: "isArray" };
2026-08-07 06:50:47 +00:00
obj[0] = tmp46;
return obj;
} else if (tmp23.APP_CHANNEL === type) {
const 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;
2026-08-14 17:33:39 +00:00
const tmp30 = new importDefault(10727)(obj2, "Invalid channel");
2026-08-07 06:50:47 +00:00
throw tmp30;
}
2026-07-20 16:05:17 +00:00
} else {
2026-08-14 17:33:39 +00:00
const obj9 = importDefault(13806)();
2026-08-07 06:50:47 +00:00
if (null == obj9) {
const obj3 = { errorCode: null };
obj3[0] = RPCErrors.INVALID_CHANNEL;
2026-08-14 17:33:39 +00:00
const tmp21 = new tmp48(10727)(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-14 17:33:39 +00:00
let tmp48Result = tmp48(10727);
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-07 06:50:47 +00:00
if (obj10.canViewInviteModal(getUncachedChannelPermissions, guild, obj9)) {
2026-08-08 06:10:11 +00:00
const obj5 = { frame: "r", channel: "PX_16", guild: "TRANSPARENT" };
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-14 17:33:39 +00:00
let tmp = tmp48(10727);
2026-08-07 06:50:47 +00:00
tmp = new tmp(obj, "No invite permissions for " + obj9.id);
throw tmp;
}
2026-08-14 17:33:39 +00:00
obj10 = require(9022) /* canViewInviteModal */;
2026-07-20 16:05:17 +00:00
}
}
}
}
};