Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4942.js (118.4 MB)
262 lines
11 KiB
TypeScript
262 lines
11 KiB
TypeScript
// Module ID: 18273
|
|
// Function ID: 18274
|
|
// Name: MediaPostEmbedManager
|
|
// Dependencies: [2097, 502, 2105, 11693, 1074, 1096, 4905, 1385, 12134, 7365, 17840, 2]
|
|
|
|
// Module 18273 (MediaPostEmbedManager)
|
|
import MediaPostEmbedUtils from "MediaPostEmbedUtils" /* 4905 */;
|
|
import setupLoadFromMessageManagerHandlersDefault from "setupLoadFromMessageManagerHandlers" /* 17840 */;
|
|
import GatedChannelStore from "GatedChannelStore" /* 2097 */;
|
|
import AuthenticationStore from "AuthenticationStore" /* 502 */;
|
|
import GuildMemberStore from "GuildMemberStore" /* 2105 */;
|
|
import MediaPostEmbedStore from "MediaPostEmbedStore" /* 11693 */;
|
|
import AutomaticLifecycleManager from "AutomaticLifecycleManager" /* 7365 */;
|
|
|
|
require = fn;
|
|
function resolveMediaPostEmbeds(embeds) {
|
|
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);
|
|
}
|
|
let tmp2 = null != found;
|
|
if (tmp2) {
|
|
tmp2 = 0 !== found.length;
|
|
}
|
|
if (tmp2) {
|
|
const item = found.forEach((url) => {
|
|
if (null != url.url) {
|
|
const mediaPostEmbedChannelPath = MediaPostEmbedUtils.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) {
|
|
if (!set.has(mediaPostEmbedChannelPath.threadId)) {
|
|
obj4.add(mediaPostEmbedChannelPath.threadId);
|
|
let guildId;
|
|
id = id.getId();
|
|
if (mediaPostEmbedChannelPath != null) {
|
|
guildId = mediaPostEmbedChannelPath.guildId;
|
|
}
|
|
const isMemberResult = member.isMember(guildId, id);
|
|
const isChannelGatedResult = channelGated.isChannelGated(mediaPostEmbedChannelPath.guildId, mediaPostEmbedChannelPath.channelId);
|
|
let num = first_message.flags;
|
|
if (num == null) {
|
|
num = 0;
|
|
}
|
|
let tmp14 = isMemberResult;
|
|
const tmp17Result = tmp17(tmp18[7]);
|
|
if (isMemberResult) {
|
|
tmp14 = false === isChannelGatedResult;
|
|
}
|
|
if (!tmp14) {
|
|
let tmp15 = !isMemberResult;
|
|
if (!isMemberResult) {
|
|
tmp15 = hasFlagResult;
|
|
}
|
|
tmp14 = tmp15;
|
|
}
|
|
if (!tmp14) {
|
|
const mediaPostEmbed = tmp17(tmp18[8]).fetchMediaPostEmbed(mediaPostEmbedChannelPath.threadId);
|
|
const tmp17Result2 = tmp17(tmp18[8]);
|
|
}
|
|
hasFlagResult = tmp17(tmp18[7]).hasFlag(num, constants2.IS_CROSSPOST);
|
|
}
|
|
obj4 = set;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
});
|
|
}
|
|
}
|
|
const FetchState = fn(11693).FetchState;
|
|
const MessageFlags = fn(1074).MessageFlags;
|
|
const set = new Set();
|
|
class MediaPostEmbedManager extends tmp7 {
|
|
constructor() {
|
|
tmp3 = new MediaPostEmbedManager(tmp2, tmp);
|
|
tmp3.actions = { LOAD_THREADS_SUCCESS: tmp3.handleLoadThreadsSuccess, LOAD_ARCHIVED_THREADS_SUCCESS: tmp3.handleLoadThreadsSuccess, LOAD_FORUM_POSTS: tmp3.handleLoadForumPosts };
|
|
obj = {
|
|
onBeforeBatch() {
|
|
return set.clear();
|
|
}
|
|
};
|
|
tmp4 = closure_1(closure_2[10])(tmp3, resolveMediaPostEmbeds, obj);
|
|
return tmp3;
|
|
}
|
|
}
|
|
const prototype = MediaPostEmbedManager.prototype;
|
|
prototype["handleLoadThreadsSuccess"] = function handleLoadThreadsSuccess(firstMessages) {
|
|
firstMessages = firstMessages.firstMessages;
|
|
if (null == firstMessages) {
|
|
return false;
|
|
} else {
|
|
set.clear();
|
|
if (firstMessages != null) {
|
|
let item = firstMessages.forEach((embeds) => {
|
|
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);
|
|
}
|
|
let tmp2 = null != found;
|
|
if (tmp2) {
|
|
tmp2 = 0 !== found.length;
|
|
}
|
|
if (tmp2) {
|
|
const item = found.forEach((url) => {
|
|
if (null != url.url) {
|
|
const mediaPostEmbedChannelPath = MediaPostEmbedUtils.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) {
|
|
if (!set.has(mediaPostEmbedChannelPath.threadId)) {
|
|
obj4.add(mediaPostEmbedChannelPath.threadId);
|
|
let guildId;
|
|
id = id.getId();
|
|
if (mediaPostEmbedChannelPath != null) {
|
|
guildId = mediaPostEmbedChannelPath.guildId;
|
|
}
|
|
const isMemberResult = member.isMember(guildId, id);
|
|
const isChannelGatedResult = channelGated.isChannelGated(mediaPostEmbedChannelPath.guildId, mediaPostEmbedChannelPath.channelId);
|
|
let num = first_message.flags;
|
|
if (num == null) {
|
|
num = 0;
|
|
}
|
|
let tmp14 = isMemberResult;
|
|
const tmp17Result = tmp17(tmp18[7]);
|
|
if (isMemberResult) {
|
|
tmp14 = false === isChannelGatedResult;
|
|
}
|
|
if (!tmp14) {
|
|
let tmp15 = !isMemberResult;
|
|
if (!isMemberResult) {
|
|
tmp15 = hasFlagResult;
|
|
}
|
|
tmp14 = tmp15;
|
|
}
|
|
if (!tmp14) {
|
|
const mediaPostEmbed = tmp17(tmp18[8]).fetchMediaPostEmbed(mediaPostEmbedChannelPath.threadId);
|
|
const tmp17Result2 = tmp17(tmp18[8]);
|
|
}
|
|
hasFlagResult = tmp17(tmp18[7]).hasFlag(num, constants2.IS_CROSSPOST);
|
|
}
|
|
obj4 = set;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
});
|
|
}
|
|
});
|
|
}
|
|
}
|
|
};
|
|
function handleLoadForumPosts(threads) {
|
|
set.clear();
|
|
const values = Object.values(threads.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) {
|
|
tmp3 = 0 !== found.length;
|
|
}
|
|
if (tmp3) {
|
|
const item = found.forEach((url) => {
|
|
if (null != url.url) {
|
|
const mediaPostEmbedChannelPath = MediaPostEmbedUtils.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) {
|
|
if (!set.has(mediaPostEmbedChannelPath.threadId)) {
|
|
obj4.add(mediaPostEmbedChannelPath.threadId);
|
|
let guildId;
|
|
id = id.getId();
|
|
if (mediaPostEmbedChannelPath != null) {
|
|
guildId = mediaPostEmbedChannelPath.guildId;
|
|
}
|
|
const isMemberResult = member.isMember(guildId, id);
|
|
const isChannelGatedResult = channelGated.isChannelGated(mediaPostEmbedChannelPath.guildId, mediaPostEmbedChannelPath.channelId);
|
|
let num = first_message.flags;
|
|
if (num == null) {
|
|
num = 0;
|
|
}
|
|
let tmp14 = isMemberResult;
|
|
const tmp17Result = tmp17(tmp18[7]);
|
|
if (isMemberResult) {
|
|
tmp14 = false === isChannelGatedResult;
|
|
}
|
|
if (!tmp14) {
|
|
let tmp15 = !isMemberResult;
|
|
if (!isMemberResult) {
|
|
tmp15 = hasFlagResult;
|
|
}
|
|
tmp14 = tmp15;
|
|
}
|
|
if (!tmp14) {
|
|
const mediaPostEmbed = tmp17(tmp18[8]).fetchMediaPostEmbed(mediaPostEmbedChannelPath.threadId);
|
|
const tmp17Result2 = tmp17(tmp18[8]);
|
|
}
|
|
hasFlagResult = tmp17(tmp18[7]).hasFlag(num, constants2.IS_CROSSPOST);
|
|
}
|
|
obj4 = set;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
});
|
|
}
|
|
}
|
|
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 };
|
|
setupLoadFromMessageManagerHandlersDefault(handleLoadForumPosts1, resolveMediaPostEmbeds, {
|
|
onBeforeBatch() {
|
|
return set.clear();
|
|
}
|
|
});
|
|
const size = fn(2);
|
|
const result = size.fileFinishedImporting("modules/media_channel/MediaPostEmbedManager.tsx");
|
|
|
|
export default handleLoadForumPosts1;
|