Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/05xxx/module_5021.js (118.4 MB)
113 lines
4.6 KiB
TypeScript
113 lines
4.6 KiB
TypeScript
// Module ID: 9718
|
|
// Function ID: 9719
|
|
// Name: useCreateThread
|
|
// Dependencies: [5, 19, 5200, 4829, 6583, 8606, 6876, 7095, 8610, 8608, 7258, 5446, 5474, 8611, 2]
|
|
// Exports: default, useCreateForumPost
|
|
|
|
// Module 9718 (useCreateThread)
|
|
import useAnalyticsLocationsDefault from "useAnalyticsLocations" /* 6583 */;
|
|
import MessageActionCreatorsDefault from "MessageActionCreators" /* 6876 */;
|
|
import MessageParserDefault from "MessageParser" /* 7095 */;
|
|
import UploadAttachmentActionCreatorsDefault from "UploadAttachmentActionCreators" /* 8608 */;
|
|
import handleUploadAttachmentErrors from "handleUploadAttachmentErrors" /* 8610 */;
|
|
import asyncGeneratorStep from "asyncGeneratorStep" /* 5 */;
|
|
import noop from "module_19" /* 19 */;
|
|
|
|
const require = globalThis.__r;
|
|
|
|
require = fn;
|
|
const DraftType = fn(5200).DraftType;
|
|
const MessageSendLocation = fn(4829).MessageSendLocation;
|
|
const size = fn(2);
|
|
const result = size.fileFinishedImporting("modules/threads/native/useCreateThread.tsx");
|
|
|
|
export default function useCreateThread(arg0) {
|
|
({ parentChannel, parentMessageId, threadSettings, privateThreadMode, location: _location, onThreadCreated, useDefaultThreadName } = arg0);
|
|
const analyticsLocations = useAnalyticsLocationsDefault().analyticsLocations;
|
|
return analyticsLocations(8606).useCreateThreadCommon({
|
|
parentChannel,
|
|
parentMessageId,
|
|
threadSettings,
|
|
privateThreadMode,
|
|
location: _location,
|
|
onThreadCreated,
|
|
useDefaultThreadName,
|
|
uploadHandler(id, attachmentsToUpload, arg2) {
|
|
const guildId = id;
|
|
const uploads = attachmentsToUpload;
|
|
let obj = MessageActionCreatorsDefault;
|
|
obj.sendMessage(id.id, MessageParserDefault.parse(id, arg2), undefined, {
|
|
location: constants.THREAD_CREATION,
|
|
attachmentsToUpload,
|
|
onAttachmentUploadError(file, code, reason) {
|
|
const obj = handleUploadAttachmentErrors;
|
|
if (obj.handleUploadMessageAttachmentsErrors(obj2)) {
|
|
const obj4 = { channelId: guildId.id, uploads, draftType: DraftType.FirstThreadMessage, resetState: true };
|
|
UploadAttachmentActionCreatorsDefault.setUploads(obj4);
|
|
}
|
|
}
|
|
});
|
|
}
|
|
});
|
|
};
|
|
export const useCreateForumPost = function useCreateForumPost(parentChannel) {
|
|
parentChannel = parentChannel.parentChannel;
|
|
const threadSettings = parentChannel.threadSettings;
|
|
let analyticsLocations;
|
|
({ appliedTags, onThreadCreated } = parentChannel);
|
|
analyticsLocations = analyticsLocations(6583)().analyticsLocations;
|
|
_require = asyncGeneratorStep(async (arg0) => {
|
|
const guildId = arg0;
|
|
c2 = 0;
|
|
c3 = 0;
|
|
return (async (arg0) => {
|
|
analyticsLocations = tmp4;
|
|
closure_129_0 = guildId;
|
|
const obj7 = new analyticsLocations(7258)();
|
|
closure_129_1 = obj7;
|
|
const maxFileSizeResult = guildId(5446).maxFileSize(guildId.getGuildId());
|
|
closure_129_2 = maxFileSizeResult;
|
|
const effectiveUploadLimit = guildId(5474).getEffectiveUploadLimit(maxFileSizeResult);
|
|
obj7.on("progress", (currentSize) => {
|
|
if (currentSize.currentSize > closure_1_3) {
|
|
analyticsLocations.cancel();
|
|
const obj2 = { channelId: uploads.id, uploads, draftType: FirstThreadMessage.FirstThreadMessage, resetState: true };
|
|
analyticsLocations(8608).setUploads(obj2);
|
|
const obj3 = { file: currentSize, maxSize: tmp, baseMaxSize, guildId: null, analyticsLocations: null };
|
|
const obj = analyticsLocations(8608);
|
|
obj3.guildId = uploads.getGuildId();
|
|
obj3.analyticsLocations = analyticsLocations;
|
|
analyticsLocations(8611)(obj3);
|
|
const tmp10 = analyticsLocations(8611);
|
|
}
|
|
});
|
|
closure_129_4 = await obj7.uploadFiles(guildId);
|
|
return { uploaderFile: closure_129_1._file, files: closure_129_4 };
|
|
})();
|
|
});
|
|
const items = [analyticsLocations, parentChannel];
|
|
const callback = noop.useCallback(function() {
|
|
const self = this;
|
|
const apply = closure_0.apply;
|
|
if (typeof apply === "unknown") {
|
|
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
|
|
} else {
|
|
applyArgumentsResult = apply(self, arguments);
|
|
}
|
|
return applyArgumentsResult;
|
|
}, items);
|
|
let obj2 = { parentChannel, name: null, appliedTags: null, analyticsLocations: null, onThreadCreated: null, upload: null };
|
|
let str;
|
|
if (threadSettings != null) {
|
|
str = threadSettings.name;
|
|
}
|
|
if (str == null) {
|
|
str = "";
|
|
}
|
|
obj2.name = str;
|
|
obj2.appliedTags = appliedTags;
|
|
obj2.analyticsLocations = analyticsLocations;
|
|
obj2.onThreadCreated = onThreadCreated;
|
|
obj2.upload = callback;
|
|
return require("ThreadCreationHooks").useCreateForumPostCommon(obj2);
|
|
};
|