Files
discord-decomp/sources/actions/AuditLogActionCreators.tsx
T
2026-07-27 16:20:00 +03:00

153 lines
7.4 KiB
TypeScript

/* Metro module 15888; source: actions/AuditLogActionCreators.tsx; dependencies: [15878, 661, 507, 694, 2] */
function _fun122611(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#122611, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16096:6, offset: 0x0256db73, size: 230 bytes, params: 8, frame: 20
const env0_0 = require;
const isLoading = function() {
return GuildSettingsAuditLogStore.isLoading || GuildSettingsAuditLogStore.isLoadingNextPage;
};
const closure = fetchLogs;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const guildSettingsAuditLogStore = importDefault(15878) /* metro dependency 15878: GuildSettingsAuditLogStore */;
const constantsModule = require(661) /* metro dependency 661: Constants */;
const env0_4 = constantsModule.Endpoints;
const env0_5 = constantsModule.AUDIT_LOG_PAGE_LIMIT;
(require(2) /* metro dependency 2 */).fileFinishedImporting('actions/AuditLogActionCreators.tsx');
exports.fetchLogs = closure;
exports.fetchNextLogPage = fetchNextLogPage;
exports.filterByAction = function(a0, a1) {
if (isLoading()) {
return undefined;
}
if (a1 == null) {
return undefined;
}
importDefault(dependencyMap[3]).dispatch({type: 'AUDIT_LOG_FILTER_BY_ACTION', action: a0});
return fetchLogs(a1, null, null, a0);
};
exports.filterByUserId = function(a0, a1) {
if (isLoading()) {
return undefined;
}
if (a1 == null) {
return undefined;
}
importDefault(dependencyMap[3]).dispatch({type: 'AUDIT_LOG_FILTER_BY_USER', userId: a0});
return fetchLogs(a1, a0);
};
exports.filterByTargetId = function(a0, a1) {
if (isLoading()) {
return undefined;
}
if (a1 == null) {
return undefined;
}
importDefault(dependencyMap[3]).dispatch({type: 'AUDIT_LOG_FILTER_BY_TARGET', targetId: a0});
return fetchLogs(a1, null, a0);
};
}
function makeRequest_122613(a0, {before, userId, targetId, action}) { // fn#122613, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16096:216, offset: 0x0256dc75, size: 212 bytes, params: 3, frame: 16
const r5 = userId ?? GuildSettingsAuditLogStore.userIdFilter;
const r2 = action ?? GuildSettingsAuditLogStore.actionFilter;
const r0 = targetId ?? GuildSettingsAuditLogStore.targetIdFilter;
const object3 = {};
object3.limit = AUDIT_LOG_PAGE_LIMIT;
if (before != null) {
object3.before = before;
}
if (r5 != null) {
object3.user_id = r5;
}
if (r2 != null) {
object3.action_type = r2;
}
if (r0 != null) {
object3.target_id = r0;
}
const HTTP = (require(507) /* metro dependency 507: HTTPUtils */).HTTP;
const get = HTTP.get;
const object4 = {};
object4.url = Endpoints.GUILD_AUDIT_LOG(a0);
object4.query = object3;
object4.oldFormErrors = true;
object4.rejectWithError = true;
return Reflect.apply(get, HTTP, [object4]);
}
function fetchLogs(a0, a1, a2, a3) { // fn#122614, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16096:618, offset: 0x0256dd49, size: 132 bytes, params: 5, frame: 17
if (isLoading()) {
return undefined;
}
if (a0 == null) {
return undefined;
}
(importDefault(694) /* metro dependency 694: Dispatcher */).dispatch({type: 'AUDIT_LOG_FETCH_START'});
return makeRequest_122613(a0, {userId: a1, action: a3, targetId: a2}).then(_fun122615, _fun122616);
}
function fetchNextLogPage(a0) { // fn#122617, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16096:1276, offset: 0x0256de8d, size: 196 bytes, params: 2, frame: 19
var id;
var value2;
var logs;
var property;
const value = a1;
if (GuildSettingsAuditLogStore.hasOlderLogs) {
if (isLoading()) {
return undefined;
}
value2 = null;
if (value2 == a0) {
return undefined;
}
logs = GuildSettingsAuditLogStore.logs;
property = logs[logs.length - 1];
id = value2 != property ? property.id : value2;
(importDefault(694) /* metro dependency 694: Dispatcher */).dispatch({type: 'AUDIT_LOG_FETCH_NEXT_PAGE_START',
before: id, isGroupedFetch: value !== undefined ? value : false});
return makeRequest_122613(a0, {before: id}).then(_fun122618, _fun122619);
}
}
function _fun122615({body}) { // fn#122615, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16096:779, offset: 0x0256ddcd, size: 143 bytes, params: 2, frame: 21
const audit_log_entries = body.audit_log_entries;
const integrations = body.integrations;
const users = body.users;
const webhooks = body.webhooks;
const guild_scheduled_events = body.guild_scheduled_events;
const auto_moderation_rules = body.auto_moderation_rules;
const threads = body.threads;
const application_commands = body.application_commands;
let value = environment.__proto__;
value = importDefault(694) /* metro dependency 694: Dispatcher */;
value.dispatch({type: 'AUDIT_LOG_FETCH_SUCCESS', logs: audit_log_entries, integrations: integrations, users: users,
webhooks: webhooks, guildScheduledEvents: guild_scheduled_events, automodRules: auto_moderation_rules,
threads: threads, applicationCommands: application_commands});
}
function _fun122616() { // fn#122616, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16096:1113, offset: 0x0256de5c, size: 49 bytes, params: 1, frame: 12
const value = environment.__proto__;
return (importDefault(694) /* metro dependency 694: Dispatcher */).dispatch({type: 'AUDIT_LOG_FETCH_FAIL'});
}
function _fun122618({body}) { // fn#122618, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16096:1530, offset: 0x0256df51, size: 143 bytes, params: 2, frame: 21
const audit_log_entries = body.audit_log_entries;
const integrations = body.integrations;
const users = body.users;
const webhooks = body.webhooks;
const guild_scheduled_events = body.guild_scheduled_events;
const auto_moderation_rules = body.auto_moderation_rules;
const threads = body.threads;
const application_commands = body.application_commands;
let value = environment.__proto__;
value = importDefault(694) /* metro dependency 694: Dispatcher */;
value.dispatch({type: 'AUDIT_LOG_FETCH_NEXT_PAGE_SUCCESS', logs: audit_log_entries, integrations: integrations,
users: users, webhooks: webhooks, guildScheduledEvents: guild_scheduled_events,
automodRules: auto_moderation_rules, threads: threads, applicationCommands: application_commands});
}
function _fun122619() { // fn#122619, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16096:1874, offset: 0x0256dfe0, size: 49 bytes, params: 1, frame: 12
const value = environment.__proto__;
return (importDefault(694) /* metro dependency 694: Dispatcher */).dispatch({type: 'AUDIT_LOG_FETCH_NEXT_PAGE_FAIL'});
}