63 lines
2.9 KiB
TypeScript
63 lines
2.9 KiB
TypeScript
// Metro module 9999 (f10000).
|
|
import UserSettingsProtoStore from "../user_settings/UserSettingsProtoStore";
|
|
import GuildChannelStore, { GUILD_SELECTABLE_CHANNELS_KEY, GUILD_VOCAL_CHANNELS_KEY } from "../../stores/GuildChannelStore";
|
|
import GuildMemberStore from "../../stores/GuildMemberStore";
|
|
import UserGuildSettingsStore from "../../stores/UserGuildSettingsStore";
|
|
import { GuildMemberFlags } from "../guild_member/GuildMemberConstants";
|
|
import * as _isOptInEnabled from "./isOptInEnabled";
|
|
import * as _Module1384 from "../../_bundle/Module1384";
|
|
import { setGuildOptIn } from "./OptInChannelsActionCreators";
|
|
import GuildOnboardingActionCreators from "../guild_onboarding/GuildOnboardingActionCreators";
|
|
import { GuildOnboardingProgress } from "../../_bundle/Module1306";
|
|
const optIntoAllChannelsForExistingMember = function optIntoAllChannelsForExistingMember(a0, r2 = {}) {
|
|
const { include = new Set(), exclude = new Set() } = r2;
|
|
let c17606_1;
|
|
let c17606_0 = exclude;
|
|
c17606_1 = void 0;
|
|
const channels = GuildChannelStore.getChannels(a0);
|
|
const r35 = [...channels[GUILD_SELECTABLE_CHANNELS_KEY], ...channels[GUILD_VOCAL_CHANNELS_KEY]].filter(({ channel }) => {
|
|
const isThread = channel.isThread();
|
|
return isThread ? !isThread : !c17606_0.has(channel.id);
|
|
}).map((item) => item.channel.id);
|
|
c17606_1 = r35;
|
|
include.forEach((item) => c17606_1.push(item));
|
|
GuildOnboardingActionCreators.onboardExistingMember(a0, new Set(r35));
|
|
};
|
|
export function hasNotSetUpChannelOptIn(a0) {
|
|
const isOptInEnabledForGuild = _isOptInEnabled.isOptInEnabledForGuild(a0);
|
|
let r15 = GuildMemberStore.getSelfMember(a0)?.flags;
|
|
if (r15 == null) {
|
|
r15 = 0;
|
|
}
|
|
const hasFlag = _Module1384.hasFlag(r15, GuildMemberFlags.COMPLETED_ONBOARDING);
|
|
const r26 = UserGuildSettingsStore.getOptedInChannels(a0).size > 0;
|
|
return (isOptInEnabledForGuild ? !isOptInEnabledForGuild : !hasFlag) && !r26;
|
|
}
|
|
export function toggleShowAllChannels(a0) {
|
|
const isOptInEnabledForGuild = _isOptInEnabled.isOptInEnabledForGuild(a0);
|
|
let r13 = GuildMemberStore.getSelfMember(a0)?.flags;
|
|
if (r13 == null) {
|
|
r13 = 0;
|
|
}
|
|
const hasFlag = _Module1384.hasFlag(r13, GuildMemberFlags.COMPLETED_ONBOARDING);
|
|
const r27 = UserGuildSettingsStore.getOptedInChannels(a0).size > 0;
|
|
if ((isOptInEnabledForGuild ? !isOptInEnabledForGuild : !hasFlag) && !r27) {
|
|
optIntoAllChannelsForExistingMember(a0);
|
|
} else {
|
|
setGuildOptIn(a0, !_isOptInEnabled.isOptInEnabledForGuild(a0));
|
|
}
|
|
}
|
|
export { optIntoAllChannelsForExistingMember };
|
|
export function hasClearedGuildOnboardingNotice(a0, r6 = UserSettingsProtoStore) {
|
|
let r4 = a0 != null;
|
|
if (r4) {
|
|
const guilds = r6.settings.guilds;
|
|
let r15 = guilds == null ? void 0 : guilds.guilds[a0]?.guildOnboardingProgress;
|
|
if (r15 == null) {
|
|
r15 = 0;
|
|
}
|
|
r4 = _Module1384.hasFlag(r15, GuildOnboardingProgress.GUILD_NOTICE_CLEARED);
|
|
}
|
|
return r4;
|
|
}
|