This commit is contained in:
janisslsm committed 2026-11-01 12:12:55 +02:00
1 parent 1781d25a15
commit 732c0ad767
33051 files changed
+2591613 -3019689

No files matched your search

@@ -0,0 +1,137 @@
// Metro module 5121 (f5122).
import ChannelStore from "../../stores/ChannelStore";
import GuildChannelStore from "../../stores/GuildChannelStore";
import GuildMemberStore from "../../stores/GuildMemberStore";
import GuildRoleStore from "../../stores/GuildRoleStore";
import PermissionStore from "../../stores/PermissionStore";
import SelectedChannelStore from "../../stores/SelectedChannelStore";
import UserGuildSettingsStore from "../../stores/UserGuildSettingsStore";
import ImpersonateStore from "./ImpersonateStore";
import { AnalyticEvents, Permissions, Routes } from "../../Constants";
import { isStaticChannelRoute } from "../channel/ChannelConstants";
import AnalyticsUtils from "../../utils/AnalyticsUtils";
import { collectGuildAnalyticsMetadata } from "../app_analytics/AppAnalyticsUtils";
import { ImpersonateType } from "./ImpersonateTypes";
import Dispatcher from "../../Dispatcher";
import { transitionTo } from "../routing/router_utils";
function $mk75472($env) {
return (a0) => $env[0].add(a0);
}
function $mk75473($env) {
return (a0) => $env[0].delete(a0);
}
const updateImpersonating = function updateImpersonating(a0, a1) {
const data = ImpersonateStore.getData(a0);
const r0 = data != null && data.type === a1.type;
L8: {
if (r0) {
AnalyticsUtils.track(AnalyticEvents.VIEW_AS_ROLES_SELECTED, {
num_roles: Object.keys(data.roles).length,
...collectGuildAnalyticsMetadata(a0),
is_viewing_as_member: data.type === ImpersonateType.NEW_MEMBER
});
Dispatcher.dispatch({
type: "IMPERSONATE_UPDATE",
guildId: a0,
data: {
...data,
...a1
}
});
const channelId = SelectedChannelStore.getChannelId(a0);
const channel = ChannelStore.getChannel(channelId);
if (channelId != null && isStaticChannelRoute(channelId)) {
break L8;
}
if (!PermissionStore.can(Permissions.VIEW_CHANNEL, channel)) {
const defaultChannel = GuildChannelStore.getDefaultChannel(a0);
if (defaultChannel != null) {
transitionTo(Routes.CHANNEL(a0, defaultChannel.id));
}
}
}
}
};
export function startImpersonating(a0, a1) {
AnalyticsUtils.track(AnalyticEvents.VIEW_AS_ROLES_SELECTED, {
num_roles: Object.keys(a1.roles).length,
...collectGuildAnalyticsMetadata(a0),
is_viewing_as_member: a1.type === ImpersonateType.NEW_MEMBER
});
Dispatcher.dispatch({
type: "IMPERSONATE_UPDATE",
guildId: a0,
data: a1
});
const channelId = SelectedChannelStore.getChannelId(a0);
const channel = ChannelStore.getChannel(channelId);
if (!(channelId != null && isStaticChannelRoute(channelId)) && !PermissionStore.can(Permissions.VIEW_CHANNEL, channel)) {
const defaultChannel = GuildChannelStore.getDefaultChannel(a0);
if (defaultChannel != null) {
transitionTo(Routes.CHANNEL(a0, defaultChannel.id));
}
}
}
export { updateImpersonating };
export function stopImpersonating(a0) {
Dispatcher.dispatch({
type: "IMPERSONATE_STOP",
guildId: a0
});
}
export function updateImpersonatedChannels(a0, a1, a2) {
let env14661;
const r2 = env14661 = {};
const set = new Set(UserGuildSettingsStore.getOptedInChannels(a0));
env14661[0] = set;
a1.forEach($mk75472(r2));
a2.forEach($mk75473(r2));
updateImpersonating(a0, {
type: ImpersonateType.NEW_MEMBER,
optInChannels: set
});
}
export function updateImpersonatedRoles(a0, a1) {
(function optIntoPrivateChannelsForGrantedRolesForPreview(a0, a1) {
let c25354_1 = [...GuildChannelStore.getSelectableChannelIds(a0), ...GuildChannelStore.getVocalChannelIds(a0)];
let c25354_2 = Array.from(a1);
GuildChannelStore.addConditionalChangeListener(() => {
const selfMember = GuildMemberStore.getSelfMember(a0);
if (selfMember == null) {
return false;
}
if (c25354_2.some((item) => !selfMember.roles.includes(item))) {
return true;
}
const r10 = [...GuildChannelStore.getSelectableChannelIds(a0), ...GuildChannelStore.getVocalChannelIds(a0)].filter((item) => !c25354_1.includes(item));
if (r10.length > 0) {
let env29464;
const r30 = [];
const r31 = env29464 = {};
const set = new Set(UserGuildSettingsStore.getOptedInChannels(a0));
env29464[0] = set;
r10.forEach($mk75472(r31));
r30.forEach($mk75473(r31));
updateImpersonating(a0, {
type: ImpersonateType.NEW_MEMBER,
optInChannels: set
});
}
return false;
});
})(a0, a1);
const roles = {};
for (const item of GuildRoleStore.getManyRoles(a0, a1)) {
roles[item.id] = item;
}
updateImpersonating(a0, {
type: ImpersonateType.NEW_MEMBER,
roles
});
}
export function updateImpersonatedData(a0, a1) {
updateImpersonating(a0, {
type: ImpersonateType.NEW_MEMBER,
...a1
});
}
+190
View File
@@ -0,0 +1,190 @@
// Metro module 1934 (f1935).
import GuildRoleStore from "../../stores/GuildRoleStore";
import GuildStore from "../../stores/GuildStore";
import { GuildSettingsSections } from "../../Constants";
import { ChannelNotificationSettingsFlags } from "../user_settings/UserSettingsConstants";
import SnowflakeUtils from "../../utils/SnowflakeUtils";
import { ImpersonateType } from "./ImpersonateTypes";
import * as _Module1384 from "../../_bundle/Module1384";
import Module589 from "../../_bundle/Module589";
import { isPlainObjectEmpty } from "../../utils/FunctionUtils";
import Dispatcher from "../../Dispatcher";
let c1620_8 = {};
class ImpersonateStore extends Module589.Store {
static displayName = "ImpersonateStore";
initialize() {
this.waitFor(GuildStore, GuildRoleStore);
}
hasViewingRoles() {
return !isPlainObjectEmpty(c1620_8);
}
isViewingRoles(a0) {
return a0 != null && c1620_8[a0] != null;
}
getViewingRoles(a0) {
return c1620_8[a0]?.roles;
}
getViewingRolesTimestamp(a0) {
return a0 != null ? c1620_8[a0]?.timestamp : null;
}
getData(a0) {
return c1620_8[a0];
}
isFullServerPreview(a0) {
return c1620_8[a0]?.type === ImpersonateType.NEW_MEMBER;
}
isOptInEnabled(a0) {
const r6 = c1620_8[a0];
return r6 != null && r6.type === ImpersonateType.NEW_MEMBER && r6.optInEnabled;
}
isOnboardingEnabled(a0) {
const r6 = c1620_8[a0];
return r6 != null && r6.type === ImpersonateType.NEW_MEMBER && r6.onboardingEnabled;
}
getViewingChannels(a0) {
const r7 = c1620_8[a0];
return r7 == null ? null : r7.type === ImpersonateType.NEW_MEMBER ? r7.optInChannels : null;
}
getOnboardingResponses(a0) {
const r7 = c1620_8[a0];
return r7 == null ? null : r7.type === ImpersonateType.NEW_MEMBER ? r7.onboardingResponses : null;
}
getMemberOptions(a0) {
const r7 = c1620_8[a0];
return r7 == null ? null : r7.type === ImpersonateType.NEW_MEMBER ? r7.memberOptions : null;
}
isChannelOptedIn(a0, a1) {
const viewingChannels = this.getViewingChannels(a0);
return viewingChannels != null && viewingChannels.has(a1);
}
isViewingServerShop(a0) {
return a0 != null && c1620_8[a0]?.type === ImpersonateType.SERVER_SHOP;
}
getImpersonateType(a0) {
if (a0 == null) {
return null;
}
const r5 = c1620_8[a0];
return r5 == null ? null : r5.type;
}
getBackNavigationSection(a0) {
if (a0 == null) {
return GuildSettingsSections.ROLES;
}
const r7 = c1620_8[a0];
if (r7 == null) {
return GuildSettingsSections.ROLES;
}
const type = r7.type;
if (ImpersonateType.ROLES !== type && ImpersonateType.SERVER_SHOP !== type) {
if (ImpersonateType.NEW_MEMBER === type) {
return GuildSettingsSections.ONBOARDING;
}
return GuildSettingsSections.ROLES;
}
return r7.returnToSection;
}
}
const impersonateStore = new ImpersonateStore(Dispatcher, {
IMPERSONATE_UPDATE: function handleImpersonateUpdate({ guildId: guildId2, data }) {
delete data.roles[SnowflakeUtils.castGuildIdAsEveryoneGuildRoleId(guildId2)];
c1620_8[guildId2] = {
...data,
timestamp: Date.now()
};
},
IMPERSONATE_STOP: function handleImpersonateStop({ guildId: guildId2 }) {
if (c1620_8[guildId2] == null) {
return false;
}
delete c1620_8[guildId2];
},
GUILD_ROLE_DELETE: function handleGuildRoleDelete({ guildId: guildId2, roleId }) {
if (c1620_8[guildId2] == null) {
return false;
}
delete c1620_8[guildId2].roles[roleId];
},
USER_GUILD_SETTINGS_CHANNEL_UPDATE_BULK: function handleUserGuildSettingsChannelUpdateBulk({ guildId: guildId2, overrides }) {
let c13354_1;
c13354_1 = void 0;
if (guildId2 != null && c1620_8[guildId2] != null) {
const r13 = c1620_8[guildId2];
if (r13 != null && r13.type === ImpersonateType.NEW_MEMBER) {
let optInChannels = r13.optInChannels;
if (optInChannels == null) {
optInChannels = new Set();
}
c13354_1 = optInChannels;
SnowflakeUtils.keys(overrides).forEach((item) => {
let flags = overrides[item].flags;
if (flags == null) {
flags = 0;
}
const hasFlag = _Module1384.hasFlag(flags, ChannelNotificationSettingsFlags.OPT_IN_ENABLED);
if (hasFlag) {
c13354_1.add(item);
} else {
c13354_1.delete(item);
}
});
r13.optInChannels = optInChannels;
return true;
}
return false;
}
return false;
},
GUILD_ONBOARDING_SELECT_OPTION: function handleOptionSelect({ guildId: guildId2, optionId, selected, removedOptionIds }) {
let c13355_0;
c13355_0 = void 0;
if (guildId2 != null && c1620_8[guildId2] != null) {
const r14 = c1620_8[guildId2];
if (r14 != null && r14.type === ImpersonateType.NEW_MEMBER) {
let onboardingResponses = r14.onboardingResponses;
if (onboardingResponses == null) {
onboardingResponses = new Set();
}
c13355_0 = onboardingResponses;
if (removedOptionIds != null && removedOptionIds.length > 0) {
removedOptionIds.forEach((removedOptionId) => c13355_0.delete(removedOptionId));
}
if (selected) {
onboardingResponses.add(optionId);
} else {
onboardingResponses.delete(optionId);
}
r14.onboardingResponses = onboardingResponses;
return true;
}
return false;
}
return false;
},
GUILD_MEMBER_UPDATE_LOCAL: function handleGuildMemberUpdateLocal({ guildId, roles, flags }) {
if (guildId == null) {
return false;
}
const r11 = c1620_8[guildId];
let r0 = r11 != null;
if (r0) {
if (roles != null) {
r11.roles = roles.reduce((acc, a1) => {
const role = GuildRoleStore.getRole(guildId, a1);
if (role != null) {
acc[a1] = role;
}
return acc;
}, {});
}
const r1 = flags != null && r11.type === ImpersonateType.NEW_MEMBER;
r0 = true;
if (r1) {
r11.memberOptions.flags = flags;
r0 = true;
}
}
return r0;
}
});
export default impersonateStore;
+7
View File
@@ -0,0 +1,7 @@
// Metro module 1940 (f1941).
const r8 = {
ROLES: "ROLES",
NEW_MEMBER: "NEW_MEMBER",
SERVER_SHOP: "SERVER_SHOP"
};
export { r8 as ImpersonateType };