Добавить UI настроек и inbox автомодерации.
CI / test (push) Failing after 3m46s
CI / push-image (push) Has been skipped
CI / deploy-ift (push) Has been skipped
CI / ci-done (push) Failing after 0s
CI / e2e-ift (push) Has been skipped
CI / deploy-stage (push) Has been skipped
CI / e2e-stage (push) Has been skipped
CI / test (push) Failing after 3m46s
CI / push-image (push) Has been skipped
CI / deploy-ift (push) Has been skipped
CI / ci-done (push) Failing after 0s
CI / e2e-ift (push) Has been skipped
CI / deploy-stage (push) Has been skipped
CI / e2e-stage (push) Has been skipped
Refs EventHub/EventHubFrontAdmin#40 Refs EventHub/EventHubFrontAdmin#41
This commit is contained in:
@@ -243,6 +243,72 @@ export async function tryHandleContentApi(
|
||||
}
|
||||
}
|
||||
|
||||
// ---- automod ----
|
||||
if (!('_automod' in content)) {
|
||||
(content as { _automod?: { settings: Record<string, unknown>; hits: Record<string, unknown>[] } })._automod = {
|
||||
settings: {
|
||||
keyword_action: 'flag',
|
||||
match_mode: 'word_boundary',
|
||||
report_threshold: 3,
|
||||
updated_at: '2026-07-14T12:00:00Z',
|
||||
updated_by: 'admin-e2e-1',
|
||||
},
|
||||
hits: [
|
||||
{
|
||||
id: 'hit-1',
|
||||
entity_type: 'event',
|
||||
entity_id: 'evt-1',
|
||||
trigger: 'keyword',
|
||||
matched_words: ['spam'],
|
||||
action_taken: 'flag',
|
||||
status: 'open',
|
||||
created_at: '2026-07-14T12:00:00Z',
|
||||
resolved_at: null,
|
||||
resolved_by: '',
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
const automod = (content as { _automod: { settings: Record<string, unknown>; hits: Record<string, unknown>[] } })._automod;
|
||||
if (method === 'GET' && path.endsWith('/v1/admin/automod/settings')) {
|
||||
await json(route, 200, automod.settings);
|
||||
return true;
|
||||
}
|
||||
if (method === 'PUT' && path.endsWith('/v1/admin/automod/settings')) {
|
||||
const payload = postData() as Record<string, unknown>;
|
||||
automod.settings = { ...automod.settings, ...payload };
|
||||
await json(route, 200, automod.settings);
|
||||
return true;
|
||||
}
|
||||
if (method === 'GET' && path.endsWith('/v1/admin/automod/hits')) {
|
||||
const status = url.searchParams.get('status');
|
||||
const rows = status
|
||||
? automod.hits.filter((h) => h.status === status)
|
||||
: automod.hits;
|
||||
await json(route, 200, rows);
|
||||
return true;
|
||||
}
|
||||
{
|
||||
const m = path.match(/\/v1\/admin\/automod\/hits\/([^/]+)$/);
|
||||
if (m && method === 'PUT') {
|
||||
const id = decodeURIComponent(m[1]);
|
||||
const payload = postData() as { status?: string };
|
||||
const idx = automod.hits.findIndex((h) => h.id === id);
|
||||
if (idx >= 0 && payload.status) {
|
||||
automod.hits[idx] = {
|
||||
...automod.hits[idx],
|
||||
status: payload.status,
|
||||
resolved_at: '2026-07-14T13:00:00Z',
|
||||
resolved_by: 'admin-e2e-1',
|
||||
};
|
||||
await json(route, 200, automod.hits[idx]);
|
||||
return true;
|
||||
}
|
||||
await json(route, 404, { error: 'not found' });
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// ---- admins ----
|
||||
if (method === 'GET' && path.endsWith('/v1/admin/admins')) {
|
||||
const page = listSlice(content.admins, url);
|
||||
|
||||
Reference in New Issue
Block a user