decord/source/experiments/ChannelSummariesExperiment.tsx

123 lines
3.6 KiB
TypeScript
Raw Normal View History

2026-07-24 07:16:23 +00:00
// Module ID: 9522
// Function ID: 74149
2026-07-20 16:05:17 +00:00
// Name: canSeeChannelSummaries
2026-07-23 10:11:24 +00:00
// Dependencies: [1391, 1838, 653, 1355, 624, 2]
2026-07-20 16:05:17 +00:00
// Exports: channelEligibleForSummaries, useChannelSummariesExperiment, useGuildEligibleForSummaries
2026-07-24 07:16:23 +00:00
// Module 9522 (canSeeChannelSummaries)
2026-07-23 10:11:24 +00:00
import { isGuildNSFW } from "isGuildOwner";
import _createForOfIteratorHelperLoose from "_createForOfIteratorHelperLoose";
import ME from "ME";
import { ChannelFlags } from "set";
let closure_4;
let closure_5;
let closure_6;
let closure_7;
let closure_8;
2026-07-20 16:05:17 +00:00
function canSeeChannelSummaries(channel, flag, flag2) {
if (flag === undefined) {
flag = false;
}
if (flag2 === undefined) {
flag2 = true;
}
let tmp = null != channel;
if (tmp) {
let flag4 = false;
if (null != channel) {
let guild_id;
if (null != channel) {
guild_id = channel.guild_id;
}
let str = "";
if (null != guild_id) {
str = guild_id;
}
const guild = store.getGuild(str);
const SUMMARIZEABLE = constants.SUMMARIZEABLE;
const tmp5 = null != guild && guild.rulesChannelId === channel.id;
const tmp7 = isGuildNSFW(guild);
flag4 = SUMMARIZEABLE.has(channel.type) && !channel.isNSFW() && !(null != guild && guild.rulesChannelId === channel.id) && !isGuildNSFW(guild);
const tmp9 = SUMMARIZEABLE.has(channel.type) && !channel.isNSFW() && !(null != guild && guild.rulesChannelId === channel.id) && !isGuildNSFW(guild);
}
let tmp11 = !tmp10;
if (!!flag4) {
let tmp12 = false !== flag;
if (!tmp12) {
tmp12 = !channel.hasFlag(ChannelFlags.SUMMARIES_DISABLED);
}
if (tmp12) {
tmp12 = canGuildUseConversationSummaries(store.getGuild(channel.guild_id), flag2);
}
tmp11 = tmp12;
}
tmp = tmp11;
}
return tmp;
}
function canGuildUseConversationSummaries(guild, flag2) {
let flag = flag2;
if (flag2 === undefined) {
flag = true;
}
let tmp = null != guild;
if (tmp) {
const id = guild.id;
let tmp2 = null != id;
if (tmp2) {
let tmp4 = id === closure_4;
if (!tmp4) {
tmp4 = id === closure_5;
}
tmp2 = tmp4;
}
let tmp6 = !tmp2;
if (!tmp2) {
const features = guild.features;
const tmp8 = !features.has(constants2.SUMMARIES_ENABLED_GA);
let tmp9 = !tmp8;
if (!tmp8) {
let hasItem = !flag;
if (!hasItem) {
const features2 = guild.features;
hasItem = features2.has(constants2.SUMMARIES_ENABLED_BY_USER);
}
tmp9 = hasItem;
}
tmp6 = tmp9;
}
tmp = tmp6;
}
return tmp;
}
2026-07-23 10:11:24 +00:00
({ ME: closure_4, FAVORITES: closure_5, ChannelTypesSets: closure_6, GuildFeatures: closure_7, EMPTY_STRING_SNOWFLAKE_ID: closure_8 } = ME);
const result = require("ME").fileFinishedImporting("experiments/ChannelSummariesExperiment.tsx");
2026-07-20 16:05:17 +00:00
export const channelEligibleForSummaries = function channelEligibleForSummaries(channel) {
return canSeeChannelSummaries(channel, true, false);
};
export { canSeeChannelSummaries };
export { canGuildUseConversationSummaries };
export const useChannelSummariesExperiment = function useChannelSummariesExperiment(channel, arg1, flag) {
if (flag === undefined) {
flag = false;
}
return canSeeChannelSummaries(channel, flag);
};
export const useGuildEligibleForSummaries = function useGuildEligibleForSummaries(arg0) {
2026-07-23 10:11:24 +00:00
const _require = arg0;
const items = [_createForOfIteratorHelperLoose];
2026-07-20 16:05:17 +00:00
const items1 = [arg0];
2026-07-23 10:11:24 +00:00
return _require(624).useStateFromStores(items, () => {
2026-07-20 16:05:17 +00:00
let id;
2026-07-23 10:11:24 +00:00
if (null != id) {
id = id.id;
2026-07-20 16:05:17 +00:00
}
if (null == id) {
2026-07-23 10:11:24 +00:00
id = outer1_8;
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
return outer1_11(outer1_3.getGuild(id), false);
2026-07-20 16:05:17 +00:00
}, items1);
};