decord/source/experiments/ChannelSummariesExperiment.tsx

178 lines
5.6 KiB
TypeScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 10592
// Function ID: 10593
2026-07-20 16:05:17 +00:00
// Name: canSeeChannelSummaries
2026-08-11 06:20:06 +00:00
// Dependencies: [1434, 1910, 676, 1398, 1913, 647, 2]
2026-07-29 08:29:29 +00:00
// Exports: canGuildUseConversationSummaries, channelEligibleForSummaries, useChannelSummariesExperiment, useGuildEligibleForSummaries
2026-07-20 16:05:17 +00:00
2026-08-24 06:08:38 +00:00
// Module 10592 (canSeeChannelSummaries)
import set from "set" /* 2 */;
import set2 from "set" /* 1398 */;
import GuildNSFWContentLevel from "GuildNSFWContentLevel" /* 1434 */;
import getFavoritesAwareGuildName from "getFavoritesAwareGuildName" /* 1913 */;
import closure_3 from "createGuildRecordFromRust" /* 1910 */;
import ME from "ME" /* 676 */;
2026-07-23 10:11:24 +00:00
2026-07-29 08:29:29 +00:00
function canSeeChannelSummaries(channel, flag, arg2) {
2026-07-20 16:05:17 +00:00
if (flag === undefined) {
flag = false;
}
2026-07-29 08:29:29 +00:00
let flag2 = arg2;
if (arg2 === undefined) {
2026-07-20 16:05:17 +00:00
flag2 = true;
}
let tmp = null != channel;
if (tmp) {
let flag4 = false;
if (null != channel) {
2026-07-29 08:29:29 +00:00
let str;
if (channel != null) {
str = channel.guild_id;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (str == null) {
str = "";
2026-07-20 16:05:17 +00:00
}
const guild = store.getGuild(str);
const SUMMARIZEABLE = constants.SUMMARIZEABLE;
2026-07-29 08:29:29 +00:00
const tmp4 = null != guild && guild.rulesChannelId === channel.id;
const tmp6 = isGuildNSFW(guild);
2026-07-20 16:05:17 +00:00
flag4 = SUMMARIZEABLE.has(channel.type) && !channel.isNSFW() && !(null != guild && guild.rulesChannelId === channel.id) && !isGuildNSFW(guild);
2026-07-29 08:29:29 +00:00
const tmp8 = SUMMARIZEABLE.has(channel.type) && !channel.isNSFW() && !(null != guild && guild.rulesChannelId === channel.id) && !isGuildNSFW(guild);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
let tmp9 = flag4;
if (tmp9) {
let tmp10 = false !== flag;
if (!tmp10) {
tmp10 = !channel.hasFlag(ChannelFlags.SUMMARIES_DISABLED);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (tmp10) {
const guild1 = store.getGuild(channel.guild_id);
if (flag2 === undefined) {
flag2 = true;
}
let tmp14 = null != guild1;
if (tmp14) {
const id = guild1.id;
let tmp15 = null != id;
if (tmp15) {
let isFavoritesGuildIdResult = id === closure_4;
if (!isFavoritesGuildIdResult) {
2026-08-24 06:08:38 +00:00
isFavoritesGuildIdResult = getFavoritesAwareGuildName.isFavoritesGuildId(id);
const obj = getFavoritesAwareGuildName;
2026-07-29 08:29:29 +00:00
}
tmp15 = isFavoritesGuildIdResult;
}
let tmp20 = !tmp15;
if (!tmp15) {
const features = guild1.features;
let hasItem = features.has(constants2.SUMMARIES_ENABLED_GA);
if (hasItem) {
hasItem = !flag2;
if (flag2) {
const features2 = guild1.features;
hasItem = features2.has(tmp21.SUMMARIES_ENABLED_BY_USER);
}
}
tmp20 = hasItem;
tmp21 = constants2;
}
tmp14 = tmp20;
}
tmp10 = tmp14;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
tmp9 = tmp10;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
tmp = tmp9;
2026-07-20 16:05:17 +00:00
}
return tmp;
}
2026-08-24 06:08:38 +00:00
const isGuildNSFW = GuildNSFWContentLevel.isGuildNSFW;
2026-07-29 08:29:29 +00:00
({ ME: c4, ChannelTypesSets: c5, GuildFeatures: closure_6, EMPTY_STRING_SNOWFLAKE_ID: error } = ME);
2026-08-24 06:08:38 +00:00
const ChannelFlags = set2.ChannelFlags;
const result = set.fileFinishedImporting("experiments/ChannelSummariesExperiment.tsx");
2026-07-29 08:29:29 +00:00
export const channelEligibleForSummaries = function channelEligibleForSummaries(channel) {
return canSeeChannelSummaries(channel, true, false);
};
export { canSeeChannelSummaries };
export const canGuildUseConversationSummaries = function canGuildUseConversationSummaries(guild, arg1) {
let flag = arg1;
if (arg1 === undefined) {
2026-07-20 16:05:17 +00:00
flag = true;
}
let tmp = null != guild;
if (tmp) {
const id = guild.id;
let tmp2 = null != id;
if (tmp2) {
2026-07-25 08:10:48 +00:00
let isFavoritesGuildIdResult = id === closure_4;
if (!isFavoritesGuildIdResult) {
2026-08-24 06:08:38 +00:00
isFavoritesGuildIdResult = getFavoritesAwareGuildName.isFavoritesGuildId(id);
const obj = getFavoritesAwareGuildName;
2026-07-20 16:05:17 +00:00
}
2026-07-25 08:10:48 +00:00
tmp2 = isFavoritesGuildIdResult;
2026-07-20 16:05:17 +00:00
}
2026-07-25 08:10:48 +00:00
let tmp7 = !tmp2;
2026-07-29 08:29:29 +00:00
if (!tmp2) {
2026-07-20 16:05:17 +00:00
const features = guild.features;
2026-07-29 08:29:29 +00:00
let hasItem = features.has(constants2.SUMMARIES_ENABLED_GA);
if (hasItem) {
hasItem = !flag;
if (flag) {
2026-07-20 16:05:17 +00:00
const features2 = guild.features;
2026-07-29 08:29:29 +00:00
hasItem = features2.has(tmp8.SUMMARIES_ENABLED_BY_USER);
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
tmp7 = hasItem;
tmp8 = constants2;
2026-07-20 16:05:17 +00:00
}
2026-07-25 08:10:48 +00:00
tmp = tmp7;
2026-07-20 16:05:17 +00:00
}
return tmp;
};
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;
2026-08-24 06:08:38 +00:00
const items = [closure_3];
2026-07-20 16:05:17 +00:00
const items1 = [arg0];
2026-07-29 08:29:29 +00:00
return _require(647).useStateFromStores(items, () => {
2026-07-20 16:05:17 +00:00
let id;
2026-07-29 08:29:29 +00:00
if (lib != null) {
id = lib.id;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (id == null) {
2026-08-24 06:08:38 +00:00
id = closure_1_7;
2026-07-20 16:05:17 +00:00
}
2026-08-24 06:08:38 +00:00
const guild = closure_1_3.getGuild(id);
2026-07-29 08:29:29 +00:00
let tmp4 = null != guild;
if (tmp4) {
id = guild.id;
let tmp5 = null != id;
if (tmp5) {
2026-08-24 06:08:38 +00:00
let isFavoritesGuildIdResult = id === closure_1_4;
2026-07-29 08:29:29 +00:00
if (!isFavoritesGuildIdResult) {
2026-08-24 06:08:38 +00:00
isFavoritesGuildIdResult = lib(closure_1_1[4]).isFavoritesGuildId(id);
const obj = lib(closure_1_1[4]);
2026-07-29 08:29:29 +00:00
}
tmp5 = isFavoritesGuildIdResult;
}
let tmp10 = !tmp5;
if (!tmp5) {
const features = guild.features;
2026-08-24 06:08:38 +00:00
let hasItem = features.has(closure_1_6.SUMMARIES_ENABLED_GA);
2026-07-29 08:29:29 +00:00
if (hasItem) {
// // eliminated: always false
hasItem = flag2;
}
tmp10 = hasItem;
}
tmp4 = tmp10;
}
return tmp4;
2026-07-20 16:05:17 +00:00
}, items1);
};