decord/source/modules/guild_home/useActiveChannels.tsx
2026-08-13 17:34:28 +00:00

78 lines
2.5 KiB
TypeScript

// Module ID: 15266
// Function ID: 15267
// Name: getActiveTextChannels
// Dependencies: [1395, 1391, 3989, 4540, 13034, 676, 1398, 1370, 2]
// Exports: getActiveTextChannels
// Module 15266 (getActiveTextChannels)
import { isTextChannel } from "createChannelRecord";
import ensureGuildLoaded from "ensureGuildLoaded";
import getUncachedChannelPermissions from "getUncachedChannelPermissions";
import updateUserGuildSettingsInternal from "updateUserGuildSettingsInternal";
import truncateOldMessageData from "truncateOldMessageData";
import { Permissions } from "ME";
import { ChannelFlags } from "set";
const result = require("getUncachedChannelPermissions").fileFinishedImporting("modules/guild_home/useActiveChannels.tsx");
export const getActiveTextChannels = function getActiveTextChannels(guildId) {
let obj;
let obj2;
let tmp = arg1;
if (arg1 === undefined) {
let items = [ensureGuildLoaded, getUncachedChannelPermissions, truncateOldMessageData, updateUserGuildSettingsInternal];
tmp = items;
}
[, , obj, obj2] = tmp;
let mutedChannels;
const activeChannelIds = obj.getActiveChannelIds(guildId);
if (null != activeChannelIds) {
const _Array = Array;
items = Array.from(activeChannelIds);
} else {
items = [];
}
mutedChannels = obj2.getMutedChannels(guildId);
const mapped = items.map((arg0) => store.getChannel(arg0));
const found = mapped.filter(require(1370) /* isDiscordFrontendDevelopment */.isNotNullish);
return found.filter((hasFlag) => {
let hasFlagResult;
if (hasFlag != null) {
hasFlagResult = hasFlag.hasFlag(outer1_8.ACTIVE_CHANNELS_REMOVED);
}
if (hasFlagResult) {
return false;
} else if (set(hasFlag.type)) {
if (set.has(hasFlag.id)) {
return false;
} else {
if (null != hasFlag.parent_id) {
if (obj.has(hasFlag.parent_id)) {
return false;
}
}
if (closure_1.can(outer1_7.VIEW_CHANNEL, hasFlag)) {
const channel = store.getChannel(hasFlag.parent_id);
const isThreadResult = hasFlag.isThread();
let tmp8 = !isThreadResult;
if (isThreadResult) {
tmp8 = null == channel;
}
if (!tmp8) {
let hasFlagResult1;
if (channel != null) {
hasFlagResult1 = channel.hasFlag(outer1_8.ACTIVE_CHANNELS_REMOVED);
}
tmp8 = !hasFlagResult1;
}
return tmp8;
} else {
return false;
}
}
obj = set;
} else {
return false;
}
});
};