// Module ID: 18492 // Function ID: 18493 // Name: MediaPostEmbedManager // Dependencies: [2116, 502, 2124, 10453, 1085, 1107, 5414, 1403, 11415, 6804, 18041, 2] // Module 18492 (MediaPostEmbedManager) import Constants from "Constants" /* 1085 */; import FlagUtils from "FlagUtils" /* 1403 */; import MediaPostEmbedUtils from "MediaPostEmbedUtils" /* 5414 */; import MediaPostEmbedStore2 from "MediaPostEmbedStore" /* 10453 */; import MediaChannelActionCreators from "MediaChannelActionCreators" /* 11415 */; import setupLoadFromMessageManagerHandlersDefault from "setupLoadFromMessageManagerHandlers" /* 18041 */; import GatedChannelStore from "GatedChannelStore" /* 2116 */; import AuthenticationStore from "AuthenticationStore" /* 502 */; import GuildMemberStore from "GuildMemberStore" /* 2124 */; import AutomaticLifecycleManager from "AutomaticLifecycleManager" /* 6804 */; import size from "module_2" /* 2 */; let first_message, id, isMember; let tmp2; let tmp3; function onBeforeBatch() { return set.clear(); } function resolveMediaPostEmbeds(embeds) { let closure_0 = embeds; embeds = embeds.embeds; let found; if (embeds != null) { found = embeds.filter((type) => type.type === first_message(closure_1_2[5]).MessageEmbedTypes.POST_PREVIEW); } const tmp2 = null != found && 0 !== found.length; if (tmp2) { const item = found.forEach((url) => { if (null != url.url) { const obj2 = MediaPostEmbedUtils; const mediaPostEmbedChannelPath = obj2.getMediaPostEmbedChannelPath(url.url); if (null != mediaPostEmbedChannelPath) { let threadId; if (mediaPostEmbedChannelPath != null) { threadId = mediaPostEmbedChannelPath.threadId; } if (null != threadId) { let channelId; if (mediaPostEmbedChannelPath != null) { channelId = mediaPostEmbedChannelPath.channelId; } if (null != channelId) { if (embedFetchState.getEmbedFetchState(mediaPostEmbedChannelPath.threadId) === constants.NOT_FETCHED) { const obj3 = set; if (!set.has(mediaPostEmbedChannelPath.threadId)) { obj3.add(mediaPostEmbedChannelPath.threadId); let guildId; id = id.getId(); isMember = isMember.isMember; if (mediaPostEmbedChannelPath != null) { guildId = mediaPostEmbedChannelPath.guildId; } const isMemberResult = isMember(guildId, id); let num = first_message.flags; const isChannelGatedResult = channelGated.isChannelGated(mediaPostEmbedChannelPath.guildId, mediaPostEmbedChannelPath.channelId); const hasFlag = FlagUtils.hasFlag; FlagUtils; if (num == null) { num = 0; } let tmp15 = isMemberResult; const hasFlagResult = hasFlag(num, constants2.IS_CROSSPOST); if (isMemberResult) { tmp15 = false === isChannelGatedResult; } if (!tmp15) { tmp15 = !isMemberResult && hasFlagResult; } if (!tmp15) { const tmp18Result2 = MediaChannelActionCreators; const mediaPostEmbed = tmp18Result2.fetchMediaPostEmbed(mediaPostEmbedChannelPath.threadId); } } } } } } } }); } } const FetchState = MediaPostEmbedStore2.FetchState; const MessageFlags = Constants.MessageFlags; const set = new Set(); class MediaPostEmbedManager extends AutomaticLifecycleManager { constructor() { const tmp3 = new MediaPostEmbedManager(tmp2, tmp); tmp3.actions = { LOAD_THREADS_SUCCESS: tmp3.handleLoadThreadsSuccess, LOAD_ARCHIVED_THREADS_SUCCESS: tmp3.handleLoadThreadsSuccess, LOAD_FORUM_POSTS: tmp3.handleLoadForumPosts }; const obj = { onBeforeBatch }; setupLoadFromMessageManagerHandlersDefault(tmp3, resolveMediaPostEmbeds, obj); return tmp3; } handleLoadThreadsSuccess(firstMessages) { firstMessages = firstMessages.firstMessages; if (null == firstMessages) { return false; } else { set.clear(); if (firstMessages != null) { let item = firstMessages.forEach((embeds) => { let closure_0 = embeds; embeds = embeds.embeds; let found; if (embeds != null) { found = embeds.filter((type) => type.type === first_message(closure_1_2[5]).MessageEmbedTypes.POST_PREVIEW); } const tmp2 = null != found && 0 !== found.length; if (tmp2) { const item = found.forEach((url) => { if (null != url.url) { const obj2 = MediaPostEmbedUtils; const mediaPostEmbedChannelPath = obj2.getMediaPostEmbedChannelPath(url.url); if (null != mediaPostEmbedChannelPath) { let threadId; if (mediaPostEmbedChannelPath != null) { threadId = mediaPostEmbedChannelPath.threadId; } if (null != threadId) { let channelId; if (mediaPostEmbedChannelPath != null) { channelId = mediaPostEmbedChannelPath.channelId; } if (null != channelId) { if (embedFetchState.getEmbedFetchState(mediaPostEmbedChannelPath.threadId) === constants.NOT_FETCHED) { const obj3 = set; if (!set.has(mediaPostEmbedChannelPath.threadId)) { obj3.add(mediaPostEmbedChannelPath.threadId); let guildId; id = id.getId(); isMember = isMember.isMember; if (mediaPostEmbedChannelPath != null) { guildId = mediaPostEmbedChannelPath.guildId; } const isMemberResult = isMember(guildId, id); let num = first_message.flags; const isChannelGatedResult = channelGated.isChannelGated(mediaPostEmbedChannelPath.guildId, mediaPostEmbedChannelPath.channelId); const hasFlag = FlagUtils.hasFlag; FlagUtils; if (num == null) { num = 0; } let tmp15 = isMemberResult; const hasFlagResult = hasFlag(num, constants2.IS_CROSSPOST); if (isMemberResult) { tmp15 = false === isChannelGatedResult; } if (!tmp15) { tmp15 = !isMemberResult && hasFlagResult; } if (!tmp15) { const tmp18Result2 = MediaChannelActionCreators; const mediaPostEmbed = tmp18Result2.fetchMediaPostEmbed(mediaPostEmbedChannelPath.threadId); } } } } } } } }); } }); } } } } const prototype = MediaPostEmbedManager.prototype; function handleLoadForumPosts(threads) { let channelGated; let constants2; let embedFetchState; threads = threads.threads; set.clear(); const values = Object.values(threads); const mapped = values.map((first_message) => { first_message = first_message.first_message; if (null != first_message) { const embeds = first_message.embeds; let found; if (embeds != null) { found = embeds.filter((type) => type.type === first_message(closure_1_2[5]).MessageEmbedTypes.POST_PREVIEW); } let tmp3 = null != found; if (tmp3) { let num = 0; tmp3 = 0 !== found.length; } if (tmp3) { const item = found.forEach((url) => { if (null != url.url) { const obj2 = MediaPostEmbedUtils; const mediaPostEmbedChannelPath = obj2.getMediaPostEmbedChannelPath(url.url); if (null != mediaPostEmbedChannelPath) { let threadId; if (mediaPostEmbedChannelPath != null) { threadId = mediaPostEmbedChannelPath.threadId; } if (null != threadId) { let channelId; if (mediaPostEmbedChannelPath != null) { channelId = mediaPostEmbedChannelPath.channelId; } if (null != channelId) { if (embedFetchState.getEmbedFetchState(mediaPostEmbedChannelPath.threadId) === constants.NOT_FETCHED) { const obj3 = set; if (!set.has(mediaPostEmbedChannelPath.threadId)) { obj3.add(mediaPostEmbedChannelPath.threadId); let guildId; id = id.getId(); isMember = isMember.isMember; if (mediaPostEmbedChannelPath != null) { guildId = mediaPostEmbedChannelPath.guildId; } const isMemberResult = isMember(guildId, id); let num = first_message.flags; const isChannelGatedResult = channelGated.isChannelGated(mediaPostEmbedChannelPath.guildId, mediaPostEmbedChannelPath.channelId); const hasFlag = FlagUtils.hasFlag; FlagUtils; if (num == null) { num = 0; } let tmp15 = isMemberResult; const hasFlagResult = hasFlag(num, constants2.IS_CROSSPOST); if (isMemberResult) { tmp15 = false === isChannelGatedResult; } if (!tmp15) { tmp15 = !isMemberResult && hasFlagResult; } if (!tmp15) { const tmp18Result2 = MediaChannelActionCreators; const mediaPostEmbed = tmp18Result2.fetchMediaPostEmbed(mediaPostEmbedChannelPath.threadId); } } } } } } } }); } } return null != first_message; }); } prototype["handleLoadForumPosts"] = handleLoadForumPosts; const handleLoadForumPosts1 = new handleLoadForumPosts(tmp4, tmp3, tmp2, Object, prototype, MediaPostEmbedManager, tmp, resolveMediaPostEmbeds); handleLoadForumPosts1.actions = { LOAD_THREADS_SUCCESS: handleLoadForumPosts1.handleLoadThreadsSuccess, LOAD_ARCHIVED_THREADS_SUCCESS: handleLoadForumPosts1.handleLoadThreadsSuccess, LOAD_FORUM_POSTS: handleLoadForumPosts1.handleLoadForumPosts }; let obj = { onBeforeBatch }; setupLoadFromMessageManagerHandlersDefault(handleLoadForumPosts1, resolveMediaPostEmbeds, obj); const result = size.fileFinishedImporting("modules/media_channel/MediaPostEmbedManager.tsx"); export default handleLoadForumPosts1;