decord/source/actions/AuditLogActionCreators.tsx

149 lines
6.8 KiB
TypeScript
Raw Normal View History

// Module ID: 17660
// Function ID: 17661
// Name: AuditLogActionCreators
// Dependencies: [17650, 1074, 1272, 573, 2]
2026-07-29 08:29:29 +00:00
// Exports: fetchLogs, fetchNextLogPage, filterByAction, filterByTargetId, filterByUserId
2026-07-20 16:05:17 +00:00
// Module 17660 (AuditLogActionCreators)
import DispatcherDefault from "Dispatcher" /* 573 */;
import HTTPUtils from "HTTPUtils" /* 1272 */;
import GuildSettingsAuditLogStore from "GuildSettingsAuditLogStore" /* 17650 */;
2026-07-23 10:11:24 +00:00
require = fn;
2026-07-20 16:05:17 +00:00
function makeRequest(arg0, arg1) {
({ before, userId, targetId, action } = arg1);
2026-07-29 08:29:29 +00:00
if (userId == null) {
userId = GuildSettingsAuditLogStore.userIdFilter;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (action == null) {
action = GuildSettingsAuditLogStore.actionFilter;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (targetId == null) {
targetId = GuildSettingsAuditLogStore.targetIdFilter;
2026-07-20 16:05:17 +00:00
}
const obj = { limit };
2026-07-20 16:05:17 +00:00
if (null != before) {
obj.before = before;
}
if (null != userId) {
obj.user_id = userId;
}
if (null != action) {
obj.action_type = action;
}
if (null != targetId) {
obj.target_id = targetId;
}
const HTTP = HTTPUtils.HTTP;
const request = { url: React4.GUILD_AUDIT_LOG(arg0), query: obj, oldFormErrors: true, rejectWithError: true };
return HTTP.get(request);
2026-07-20 16:05:17 +00:00
}
const Constants = fn(1074);
({ Endpoints: closure_4, AUDIT_LOG_PAGE_LIMIT: hasOwnProperty } = Constants);
const size = fn(2);
const result = size.fileFinishedImporting("actions/AuditLogActionCreators.tsx");
2026-07-29 08:29:29 +00:00
export const fetchLogs = function fetchLogs(guildId, userId, targetId, action) {
2026-07-29 08:29:29 +00:00
if (!tmp) {
2026-07-20 16:05:17 +00:00
if (null != guildId) {
DispatcherDefault.dispatch({ type: "AUDIT_LOG_FETCH_START" });
const obj2 = { userId, action, targetId };
return makeRequest(guildId, obj2).then((body) => {
2026-07-20 16:05:17 +00:00
({ audit_log_entries, integrations, users, webhooks, guild_scheduled_events, auto_moderation_rules, threads, application_commands } = body.body);
DispatcherDefault.dispatch({ type: "AUDIT_LOG_FETCH_SUCCESS", logs: audit_log_entries, integrations, users, webhooks, guildScheduledEvents: guild_scheduled_events, automodRules: auto_moderation_rules, threads, applicationCommands: application_commands });
}, () => DispatcherDefault.dispatch({ type: "AUDIT_LOG_FETCH_FAIL" }));
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
};
2026-07-20 16:05:17 +00:00
export const fetchNextLogPage = function fetchNextLogPage(guildId) {
let flag = arg1;
if (arg1 === undefined) {
flag = false;
}
if (GuildSettingsAuditLogStore.hasOlderLogs) {
2026-07-29 08:29:29 +00:00
if (!tmp2) {
2026-07-20 16:05:17 +00:00
if (null != guildId) {
2026-07-29 08:29:29 +00:00
const logs = tmp.logs;
2026-07-20 16:05:17 +00:00
let id = null;
if (null != logs[logs.length - 1]) {
2026-07-29 08:29:29 +00:00
id = tmp10.id;
2026-07-20 16:05:17 +00:00
}
const obj2 = { type: "AUDIT_LOG_FETCH_NEXT_PAGE_START", before: id, isGroupedFetch: flag };
DispatcherDefault.dispatch(obj2);
const obj3 = { before: id };
return makeRequest(guildId, obj3).then((body) => {
2026-07-20 16:05:17 +00:00
({ audit_log_entries, integrations, users, webhooks, guild_scheduled_events, auto_moderation_rules, threads, application_commands } = body.body);
DispatcherDefault.dispatch({ type: "AUDIT_LOG_FETCH_NEXT_PAGE_SUCCESS", logs: audit_log_entries, integrations, users, webhooks, guildScheduledEvents: guild_scheduled_events, automodRules: auto_moderation_rules, threads, applicationCommands: application_commands });
}, () => DispatcherDefault.dispatch({ type: "AUDIT_LOG_FETCH_NEXT_PAGE_FAIL" }));
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
tmp2 = tmp.isLoading || tmp.isLoadingNextPage;
2026-07-20 16:05:17 +00:00
}
};
export const filterByAction = function filterByAction(navigation, guildId) {
2026-07-29 08:29:29 +00:00
if (!tmp2) {
2026-07-20 16:05:17 +00:00
if (null != guildId) {
const obj = { type: "AUDIT_LOG_FILTER_BY_ACTION", action: navigation };
DispatcherDefault.dispatch(obj);
2026-07-29 08:29:29 +00:00
let nextPromise;
if (!tmp5) {
if (null != guildId) {
DispatcherDefault.dispatch({ type: "AUDIT_LOG_FETCH_START" });
const obj2 = { userId: null, action: navigation, targetId: null };
const tmp10Result = DispatcherDefault;
nextPromise = makeRequest(guildId, obj2).then((body) => {
2026-07-29 08:29:29 +00:00
({ audit_log_entries, integrations, users, webhooks, guild_scheduled_events, auto_moderation_rules, threads, application_commands } = body.body);
DispatcherDefault.dispatch({ type: "AUDIT_LOG_FETCH_SUCCESS", logs: audit_log_entries, integrations, users, webhooks, guildScheduledEvents: guild_scheduled_events, automodRules: auto_moderation_rules, threads, applicationCommands: application_commands });
}, () => DispatcherDefault.dispatch({ type: "AUDIT_LOG_FETCH_FAIL" }));
const promise = makeRequest(guildId, obj2);
2026-07-29 08:29:29 +00:00
}
}
return nextPromise;
2026-07-20 16:05:17 +00:00
}
}
};
export const filterByUserId = function filterByUserId(id, guildId) {
2026-07-29 08:29:29 +00:00
if (!tmp2) {
2026-07-20 16:05:17 +00:00
if (null != guildId) {
const obj = { type: "AUDIT_LOG_FILTER_BY_USER", userId: id };
DispatcherDefault.dispatch(obj);
2026-07-29 08:29:29 +00:00
let nextPromise;
if (!tmp5) {
if (null != guildId) {
DispatcherDefault.dispatch({ type: "AUDIT_LOG_FETCH_START" });
const obj2 = { userId: id, action: "Array", targetId: "accessible" };
const tmp10Result = DispatcherDefault;
nextPromise = makeRequest(guildId, obj2).then((body) => {
2026-07-29 08:29:29 +00:00
({ audit_log_entries, integrations, users, webhooks, guild_scheduled_events, auto_moderation_rules, threads, application_commands } = body.body);
DispatcherDefault.dispatch({ type: "AUDIT_LOG_FETCH_SUCCESS", logs: audit_log_entries, integrations, users, webhooks, guildScheduledEvents: guild_scheduled_events, automodRules: auto_moderation_rules, threads, applicationCommands: application_commands });
}, () => DispatcherDefault.dispatch({ type: "AUDIT_LOG_FETCH_FAIL" }));
const promise = makeRequest(guildId, obj2);
2026-07-29 08:29:29 +00:00
}
}
return nextPromise;
2026-07-20 16:05:17 +00:00
}
}
};
export const filterByTargetId = function filterByTargetId(targetId, arg1) {
2026-07-29 08:29:29 +00:00
if (!tmp2) {
if (null != arg1) {
const obj = { type: "AUDIT_LOG_FILTER_BY_TARGET", targetId };
DispatcherDefault.dispatch(obj);
2026-07-29 08:29:29 +00:00
let nextPromise;
if (!tmp5) {
if (null != arg1) {
DispatcherDefault.dispatch({ type: "AUDIT_LOG_FETCH_START" });
const obj2 = { userId: null, action: "Array", targetId };
const tmp10Result = DispatcherDefault;
nextPromise = makeRequest(arg1, obj2).then((body) => {
2026-07-29 08:29:29 +00:00
({ audit_log_entries, integrations, users, webhooks, guild_scheduled_events, auto_moderation_rules, threads, application_commands } = body.body);
DispatcherDefault.dispatch({ type: "AUDIT_LOG_FETCH_SUCCESS", logs: audit_log_entries, integrations, users, webhooks, guildScheduledEvents: guild_scheduled_events, automodRules: auto_moderation_rules, threads, applicationCommands: application_commands });
}, () => DispatcherDefault.dispatch({ type: "AUDIT_LOG_FETCH_FAIL" }));
const promise = makeRequest(arg1, obj2);
2026-07-29 08:29:29 +00:00
}
}
return nextPromise;
2026-07-20 16:05:17 +00:00
}
}
};