decord/source/modules/media_uploads/handleUploadAttachmentErrors.native.tsx

82 lines
3.3 KiB
TypeScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 8506
// Function ID: 8507
2026-07-20 16:05:17 +00:00
// Name: handleUploadMessageAttachmentsErrors
2026-08-24 06:08:38 +00:00
// Dependencies: [676, 4881, 4839, 8507, 4832, 1236, 12791, 2]
2026-07-20 16:05:17 +00:00
// Exports: handleUploadMessageAttachmentsErrors
2026-08-24 06:08:38 +00:00
// Module 8506 (handleUploadMessageAttachmentsErrors)
import set from "set" /* 2 */;
import getSystemLocale from "getSystemLocale" /* 1236 */;
import setDefault from "set" /* 4832 */;
import getUploadFileSizeSum from "getUploadFileSizeSum" /* 4839 */;
import KESTREL_GA_UPLOAD_LIMIT_MB from "KESTREL_GA_UPLOAD_LIMIT_MB" /* 4881 */;
import showUploadFileSizeErrorDefault from "showUploadFileSizeError" /* 8507 */;
import getAttachmentUploadAbortAlertContent from "getAttachmentUploadAbortAlertContent" /* 12791 */;
import ME from "ME" /* 676 */;
2026-07-23 10:11:24 +00:00
2026-07-29 08:29:29 +00:00
({ AbortCodes: c3, MAX_UPLOAD_COUNT: c4 } = ME);
2026-08-24 06:08:38 +00:00
const result = set.fileFinishedImporting("modules/media_uploads/handleUploadAttachmentErrors.native.tsx");
2026-07-20 16:05:17 +00:00
export const handleUploadMessageAttachmentsErrors = function handleUploadMessageAttachmentsErrors(arg0) {
2026-07-29 08:29:29 +00:00
({ guildId, code, reason } = arg0);
2026-07-20 16:05:17 +00:00
if (undefined === code) {
return false;
} else if (code === constants.ENTITY_TOO_LARGE) {
2026-08-24 06:08:38 +00:00
const kestrelConfig = KESTREL_GA_UPLOAD_LIMIT_MB.getKestrelConfig({ location: "native.handleUploadMessageAttachmentsErrors" });
const obj10 = KESTREL_GA_UPLOAD_LIMIT_MB;
const maxFileSizeResult = getUploadFileSizeSum.maxFileSize(guildId);
2026-07-29 08:29:29 +00:00
let obj = { file: null, maxSize: null, baseMaxSize: null, guildId: null, analyticsLocations: null, errorReason: null };
obj[0] = tmp;
2026-08-24 06:08:38 +00:00
const obj11 = getUploadFileSizeSum;
const tmp27 = showUploadFileSizeErrorDefault;
obj[1] = KESTREL_GA_UPLOAD_LIMIT_MB.getEffectiveKestrelLimit(kestrelConfig, maxFileSizeResult);
2026-07-29 08:29:29 +00:00
obj[2] = maxFileSizeResult;
obj[3] = guildId;
obj[4] = tmp2;
2026-07-20 16:05:17 +00:00
let type;
2026-07-29 08:29:29 +00:00
if (reason != null) {
2026-07-20 16:05:17 +00:00
type = reason.type;
}
2026-07-29 08:29:29 +00:00
obj[5] = type;
tmp27(obj);
2026-07-20 16:05:17 +00:00
return true;
2026-07-29 08:29:29 +00:00
} else if (code === tmp31.TOO_MANY_ATTACHMENTS) {
obj = { title: null, body: null };
2026-08-24 06:08:38 +00:00
const intl5 = getSystemLocale.intl;
obj[0] = intl5.string(getSystemLocale.t.wOr6hB);
const intl6 = getSystemLocale.intl;
obj1 = { limit: null };
2026-07-29 08:29:29 +00:00
obj1[0] = closure_4;
2026-08-24 06:08:38 +00:00
obj[1] = intl6.formatToPlainString(getSystemLocale.t["qqyp/e"], obj1);
setDefault.show(obj);
2026-07-20 16:05:17 +00:00
return true;
2026-07-29 08:29:29 +00:00
} else if (code === tmp31.ENTITY_EMPTY) {
let obj2 = { title: null, body: null };
2026-08-24 06:08:38 +00:00
const intl3 = getSystemLocale.intl;
obj2[0] = intl3.string(getSystemLocale.t.B3vFdU);
const intl4 = getSystemLocale.intl;
obj2[1] = intl4.string(getSystemLocale.t["9ZpT2C"]);
setDefault.show(obj2);
2026-07-20 16:05:17 +00:00
return true;
2026-07-29 08:29:29 +00:00
} else if (code === tmp31.INVALID_FILE_ASSET) {
2026-08-24 06:08:38 +00:00
obj2 = setDefault;
2026-07-29 08:29:29 +00:00
const obj3 = { title: null, body: null };
2026-08-24 06:08:38 +00:00
const intl = getSystemLocale.intl;
obj3[0] = intl.string(getSystemLocale.t.B3vFdU);
const intl2 = getSystemLocale.intl;
obj3[1] = intl2.string(getSystemLocale.t.zMEjJg);
2026-07-29 08:29:29 +00:00
obj2.show(obj3);
2026-07-20 16:05:17 +00:00
return true;
} else {
2026-08-24 06:08:38 +00:00
obj = getAttachmentUploadAbortAlertContent;
2026-07-20 16:05:17 +00:00
const attachmentUploadAbortAlertContent = obj.getAttachmentUploadAbortAlertContent(code);
let flag = null != attachmentUploadAbortAlertContent;
if (flag) {
2026-08-24 06:08:38 +00:00
obj1 = setDefault;
2026-07-20 16:05:17 +00:00
obj1.show(attachmentUploadAbortAlertContent);
flag = true;
}
return flag;
}
};