2026-09-18 06:58:00 +00:00
|
|
|
// Module ID: 14700
|
|
|
|
|
// Function ID: 14701
|
2026-07-20 16:05:17 +00:00
|
|
|
// Name: validateOpenInviteDialog
|
2026-09-18 06:58:00 +00:00
|
|
|
// Dependencies: [9748, 1958, 1980, 4361, 4626, 1074, 9749, 9802, 14687, 10019, 2]
|
2026-07-20 16:05:17 +00:00
|
|
|
// Exports: validateOpenInviteDialog
|
|
|
|
|
|
2026-09-18 06:58:00 +00:00
|
|
|
// Module 14700 (validateOpenInviteDialog)
|
|
|
|
|
import RPCErrorDefault from "RPCError" /* 9802 */;
|
|
|
|
|
import canViewInviteModal from "canViewInviteModal" /* 10019 */;
|
|
|
|
|
import getCurrentEmbeddedActivityChannelDefault from "getCurrentEmbeddedActivityChannel" /* 14687 */;
|
|
|
|
|
import FramesStore from "FramesStore" /* 9748 */;
|
2026-09-15 14:23:42 +00:00
|
|
|
import ChannelStore from "ChannelStore" /* 1958 */;
|
|
|
|
|
import GuildStore from "GuildStore" /* 1980 */;
|
2026-09-18 06:58:00 +00:00
|
|
|
import PermissionStore from "PermissionStore" /* 4361 */;
|
2026-07-23 10:11:24 +00:00
|
|
|
|
2026-09-10 05:38:07 +00:00
|
|
|
require = fn;
|
2026-09-18 06:58:00 +00:00
|
|
|
const TransportTypes = fn(4626).TransportTypes;
|
2026-09-10 05:38:07 +00:00
|
|
|
const RPCErrors = fn(1074).RPCErrors;
|
2026-09-18 06:58:00 +00:00
|
|
|
const FramesConstants = fn(9749);
|
2026-09-10 05:38:07 +00:00
|
|
|
({ asLaunched: closure_9, EmbeddedSurfaceType: c10 } = FramesConstants);
|
|
|
|
|
const size = fn(2);
|
|
|
|
|
const result = size.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) {
|
2026-09-10 05:38:07 +00:00
|
|
|
const obj2 = { errorCode: RPCErrors.INVALID_COMMAND };
|
2026-08-07 06:50:47 +00:00
|
|
|
const _HermesInternal3 = HermesInternal;
|
2026-09-10 05:38:07 +00:00
|
|
|
const tmp362 = new RPCErrorDefault(obj2, "command not available from \"" + socket.source.type + "\" transport");
|
|
|
|
|
throw tmp362;
|
2026-07-20 16:05:17 +00:00
|
|
|
} else {
|
2026-09-10 05:38:07 +00:00
|
|
|
const tmp46 = React7(FramesStore.getFrameByIframeId(socket.source.iframeId));
|
2026-08-07 06:50:47 +00:00
|
|
|
if (null != tmp46) {
|
|
|
|
|
const surface = tmp46.surface;
|
|
|
|
|
const type = surface.type;
|
|
|
|
|
if (constants.MAIN === type) {
|
2026-09-14 20:04:03 +00:00
|
|
|
const obj3 = { frame: tmp46, channel: "Array", guild: "isArray" };
|
2026-09-10 05:38:07 +00:00
|
|
|
return obj3;
|
2026-08-07 06:50:47 +00:00
|
|
|
} else {
|
2026-09-11 10:30:06 +00:00
|
|
|
if (tmp23.APP_CHANNEL !== type) {
|
|
|
|
|
if (tmp23.VOICE_CHANNEL !== type) {
|
|
|
|
|
const obj4 = { errorCode: RPCErrors.INVALID_CHANNEL };
|
|
|
|
|
const tmp30 = new RPCErrorDefault(obj4, "Invalid channel");
|
|
|
|
|
throw tmp30;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
const obj5 = { frame: tmp46, channel: ChannelStore.getChannel(surface.channelId), guild: GuildStore.getGuild(surface.guildId) };
|
|
|
|
|
return obj5;
|
2026-08-07 06:50:47 +00:00
|
|
|
}
|
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) {
|
2026-09-10 05:38:07 +00:00
|
|
|
const obj6 = { errorCode: RPCErrors.INVALID_CHANNEL };
|
2026-09-18 06:58:00 +00:00
|
|
|
const tmp21 = new tmp48(9802)(obj6, "Invalid channel");
|
2026-08-07 06:50:47 +00:00
|
|
|
throw tmp21;
|
2026-07-20 16:05:17 +00:00
|
|
|
} else {
|
2026-09-10 05:38:07 +00:00
|
|
|
const guild = GuildStore.getGuild(obj9.getGuildId());
|
2026-08-07 06:50:47 +00:00
|
|
|
if (null == guild) {
|
2026-09-10 05:38:07 +00:00
|
|
|
const obj7 = { errorCode: RPCErrors.INVALID_CHANNEL };
|
2026-08-07 06:50:47 +00:00
|
|
|
const _HermesInternal2 = HermesInternal;
|
2026-09-18 06:58:00 +00:00
|
|
|
const tmp48Result1 = new tmp48(9802)(obj7, "Invalid guild " + obj9.getGuildId());
|
2026-09-10 05:38:07 +00:00
|
|
|
throw tmp48Result1;
|
2026-07-20 16:05:17 +00:00
|
|
|
} else {
|
2026-09-10 05:38:07 +00:00
|
|
|
if (obj10.canViewInviteModal(PermissionStore, guild, obj9)) {
|
|
|
|
|
const obj8 = { frame: "r", channel: obj9, guild };
|
|
|
|
|
return obj8;
|
2026-08-07 06:50:47 +00:00
|
|
|
} else {
|
2026-09-10 05:38:07 +00:00
|
|
|
const obj = { errorCode: RPCErrors.INVALID_PERMISSIONS };
|
2026-08-07 06:50:47 +00:00
|
|
|
const _HermesInternal = HermesInternal;
|
2026-09-18 06:58:00 +00:00
|
|
|
const tmp7 = new tmp48(9802)(obj, "No invite permissions for " + obj9.id);
|
2026-09-10 05:38:07 +00:00
|
|
|
throw tmp7;
|
2026-08-07 06:50:47 +00:00
|
|
|
}
|
2026-08-24 06:08:38 +00:00
|
|
|
obj10 = canViewInviteModal;
|
2026-07-20 16:05:17 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|