157 lines
8.0 KiB
TypeScript
157 lines
8.0 KiB
TypeScript
/* Metro module 15888; source: actions/AuditLogActionCreators.tsx; dependencies: [15878, 661, 507, 694, 2] */
|
|
import Dispatcher from '../Dispatcher.tsx'; /* Metro dependency 694 */
|
|
import GuildSettingsAuditLogStore from '../modules/guild_settings/audit_log/GuildSettingsAuditLogStore.tsx'; /* Metro dependency 15878 */
|
|
import * as FileImportTrackerModule from '../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as HTTPUtilsModule from '../external/discord_common/js/packages/http-utils/HTTPUtils.tsx'; /* Metro dependency 507 */
|
|
import * as ConstantsModule from '../Constants.tsx'; /* Metro dependency 661 */
|
|
|
|
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 fetchLogs2 = fetchLogs;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
(FileImportTrackerModule).fileFinishedImporting('actions/AuditLogActionCreators.tsx');
|
|
exports.fetchLogs = fetchLogs2;
|
|
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 object = {};
|
|
object.limit = AUDIT_LOG_PAGE_LIMIT;
|
|
if (before != null) {
|
|
object.before = before;
|
|
}
|
|
if (r5 != null) {
|
|
object.user_id = r5;
|
|
}
|
|
if (r2 != null) {
|
|
object.action_type = r2;
|
|
}
|
|
if (r0 != null) {
|
|
object.target_id = r0;
|
|
}
|
|
const HTTP = (HTTPUtilsModule).HTTP;
|
|
const get = HTTP.get;
|
|
const object2 = {};
|
|
object2.url = Endpoints.GUILD_AUDIT_LOG(a0);
|
|
object2.query = object;
|
|
object2.oldFormErrors = true;
|
|
object2.rejectWithError = true;
|
|
return Reflect.apply(get, HTTP, [object2]);
|
|
}
|
|
|
|
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;
|
|
}
|
|
(Dispatcher).dispatch({type: 'AUDIT_LOG_FETCH_START'});
|
|
return makeRequest_122613(a0, {userId: a1, action: a3, targetId: a2}).then(_fun122615, _fun122616);
|
|
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 (Dispatcher).dispatch({type: 'AUDIT_LOG_FETCH_FAIL'});
|
|
}
|
|
|
|
}
|
|
|
|
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 _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 (Dispatcher).dispatch({type: 'AUDIT_LOG_FETCH_NEXT_PAGE_FAIL'});
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun122611, 15888, [15878, 661, 507, 694,
|
|
2]) /* metro module 15888, dependencies: [15878, 661, 507, 694, 2] */;
|