A free and open source instant messaging and VoIP chat app built for friends, groups, and communities.
fix(admin): preview message shreds and remove only what's listed (#3746)
Hampus77835055808c
diff --git a/fluxer_admin/openapi-admin.json b/fluxer_admin/openapi-admin.jsonindex d7f5bbbaa..391314503 100644--- a/fluxer_admin/openapi-admin.json+++ b/fluxer_admin/openapi-admin.json@@ -9940,7 +9940,7 @@"content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}},- "description": "Queues bulk shredding of the given messages of a user, with attachment deletion. Returns a job ID to track progress asynchronously. With an enforcement basis the first 50 entries are snapshotted as the evidence of a content removal decision before the job is queued, every entry for child safety and violent extremism reasons, and the user is sent its notice. Requires MESSAGE_SHRED permission.",+ "description": "Queues bulk shredding of the given messages of a user, with attachment deletion. Only messages the user sent in the named channel are removed. With preview_token from the preview route, exactly the previewed messages are removed, and the request is refused with MESSAGE_SHRED_PREVIEW_CHANGED when they changed since. Returns a job ID to track progress asynchronously. With an enforcement basis the first 50 entries are snapshotted as the evidence of a content removal decision before the job is queued, every entry for child safety and violent extremism reasons, and the user is sent its notice. Requires MESSAGE_SHRED permission.","security": [{"adminApiKey": []}],"parameters": [{@@ -9957,6 +9957,74 @@}}},+ "/admin/users/{user_id}/message-shreds/preview": {+ "post": {+ "operationId": "preview_admin_user_message_shred",+ "summary": "Preview a message shred",+ "tags": ["Admin"],+ "responses": {+ "200": {+ "description": "Success",+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/MessageShredPreviewResponse"}}}+ },+ "400": {+ "description": "Bad Request - The request was malformed or contained invalid data",+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}+ },+ "401": {+ "description": "Unauthorized - Authentication is required or the token is invalid",+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}+ },+ "403": {+ "description": "Forbidden - You do not have permission to perform this action",+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}+ },+ "429": {+ "description": "Too Many Requests - You are being rate limited",+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ThrottledError"}}},+ "headers": {+ "Retry-After": {+ "description": "Number of seconds to wait before retrying (only on 429)",+ "schema": {"type": "integer"}+ },+ "X-RateLimit-Limit": {+ "description": "The number of requests that can be made in the current window",+ "schema": {"type": "integer"}+ },+ "X-RateLimit-Remaining": {+ "description": "The number of remaining requests that can be made",+ "schema": {"type": "integer"}+ },+ "X-RateLimit-Reset": {+ "description": "Unix timestamp when the rate limit resets",+ "schema": {"type": "integer"}+ }+ }+ },+ "500": {+ "description": "Internal Server Error - An unexpected error occurred",+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}+ }+ },+ "description": "Lists exactly the messages a shred of these entries removes: entries the user sent in that channel. Entries that are missing, sent by someone else or listed twice are returned in skipped and are never removed. Pass preview_token with the shred to remove exactly these messages. Nothing is removed and no decision is recorded. Requires MESSAGE_SHRED permission.",+ "security": [{"adminApiKey": []}],+ "parameters": [+ {+ "name": "user_id",+ "in": "path",+ "required": true,+ "schema": {"description": "The ID of the user", "allOf": [{"$ref": "#/components/schemas/SnowflakeType"}]},+ "description": "The ID of the user"+ }+ ],+ "requestBody": {+ "required": true,+ "content": {+ "application/json": {"schema": {"$ref": "#/components/schemas/AdminUserMessageShredPreviewRequest"}}+ }+ }+ }+ },"/admin/users/{user_id}/messages": {"delete": {"operationId": "delete_admin_user_messages",@@ -14968,6 +15036,75 @@"required": ["success", "dry_run", "channel_count", "message_count"],"additionalProperties": false},+ "AdminUserMessageShredPreviewRequest": {+ "type": "object",+ "properties": {+ "entries": {+ "minItems": 1,+ "maxItems": 1000,+ "type": "array",+ "items": {+ "type": "object",+ "properties": {+ "channel_id": {"$ref": "#/components/schemas/SnowflakeType"},+ "message_id": {"$ref": "#/components/schemas/SnowflakeType"}+ },+ "required": ["channel_id", "message_id"]+ }+ }+ },+ "required": ["entries"]+ },+ "MessageShredPreviewResponse": {+ "type": "object",+ "properties": {+ "requested": {"$ref": "#/components/schemas/Int32Type"},+ "message_count": {+ "description": "How many messages a shred of these entries removes",+ "allOf": [{"$ref": "#/components/schemas/Int32Type"}]+ },+ "messages": {+ "type": "array",+ "items": {+ "type": "object",+ "properties": {+ "channel_id": {"$ref": "#/components/schemas/SnowflakeStringType"},+ "message_id": {"$ref": "#/components/schemas/SnowflakeStringType"},+ "timestamp": {"type": "string", "description": "When the message was sent, as an ISO 8601 timestamp"},+ "content": {"type": "string", "description": "The start of the message text, up to 200 characters"},+ "attachment_count": {"$ref": "#/components/schemas/Int32Type"}+ },+ "required": ["channel_id", "message_id", "timestamp", "content", "attachment_count"],+ "additionalProperties": false+ },+ "description": "Every message a shred of these entries removes"+ },+ "skipped": {+ "type": "array",+ "items": {+ "type": "object",+ "properties": {+ "channel_id": {"$ref": "#/components/schemas/SnowflakeStringType"},+ "message_id": {"$ref": "#/components/schemas/SnowflakeStringType"},+ "reason": {+ "type": "string",+ "enum": ["not_found", "other_author", "duplicate"],+ "description": "not_found when the message is not in that channel, other_author when someone else sent it"+ }+ },+ "required": ["channel_id", "message_id", "reason"],+ "additionalProperties": false+ },+ "description": "Entries a shred leaves alone, with the reason"+ },+ "preview_token": {+ "type": "string",+ "description": "Pass this with the shred to remove exactly these messages"+ }+ },+ "required": ["requested", "message_count", "messages", "skipped", "preview_token"],+ "additionalProperties": false+ },"AdminUserMessageShredRequest": {"type": "object","properties": {@@ -14984,7 +15121,12 @@"required": ["channel_id", "message_id"]}},- "basis": {"allOf": [{"$ref": "#/components/schemas/ModerationBasis"}]}+ "basis": {"allOf": [{"$ref": "#/components/schemas/ModerationBasis"}]},+ "preview_token": {+ "description": "The preview_token of a preview of the same entries. When given, exactly the previewed messages are removed, and the request is refused if they changed since the preview",+ "type": "string",+ "pattern": "^[0-9a-f]{64}$"+ }},"required": ["entries", "basis"]},diff --git a/fluxer_admin/src/api/messages.rs b/fluxer_admin/src/api/messages.rsindex 641efdac5..efe73ecaf 100644--- a/fluxer_admin/src/api/messages.rs+++ b/fluxer_admin/src/api/messages.rs@@ -55,15 +55,35 @@ impl AdminApiClient {self.generated_value(response.into_inner())}+ pub async fn preview_message_shred(+ &self,+ user_id: &str,+ entries: Vec<generated_types::AdminUserMessageShredPreviewRequestEntriesItem>,+ ) -> ApiResult<generated_types::MessageShredPreviewResponse> {+ let body = generated_types::AdminUserMessageShredPreviewRequest { entries };+ self.send(+ Method::POST,+ &format!(+ "/admin/users/{}/message-shreds/preview",+ urlencoding::encode(user_id)+ ),+ Some(&body),+ None,+ )+ .await+ }+pub async fn queue_message_shred(&self,user_id: &str,entries: Vec<generated_types::AdminUserMessageShredRequestEntriesItem>,basis: &BasisSubmission,+ preview_token: generated_types::AdminUserMessageShredRequestPreviewToken,) -> ApiResult<generated_types::MessageShredResponse> {let body = generated_types::AdminUserMessageShredRequest {basis: basis.moderation_basis(),entries,+ preview_token: Some(preview_token),};self.send(Method::POST,diff --git a/fluxer_admin/src/routes/user_actions.rs b/fluxer_admin/src/routes/user_actions.rsindex 95ee82b8b..49316a635 100644--- a/fluxer_admin/src/routes/user_actions.rs+++ b/fluxer_admin/src/routes/user_actions.rs@@ -8,7 +8,10 @@ use crate::{enforcement::ClosureRequest,generated::{snowflake,- types::{AdminUserFeatureLimitRequestLimit, AdminUserMessageShredRequestEntriesItem},+ types::{+ AdminUserFeatureLimitRequestLimit, AdminUserMessageShredRequestEntriesItem,+ AdminUserMessageShredRequestPreviewToken,+ },},},middleware::flash::FlashData,@@ -474,19 +477,34 @@ pub async fn dispatch("Failed to cancel bulk message deletion",),"message_shred" => {- let entries = match parse_message_shred_csv(form.first("csv_data").unwrap_or_default())- {- Ok(entries) if entries.is_empty() => {- return DispatchOutcome::error("The CSV has no channel_id,message_id rows.");- }+ let entries = match message_shred_entries(form.first("csv_data").unwrap_or_default()) {Ok(entries) => entries,Err(error) => return DispatchOutcome::error(error),};+ let Some(preview_token) = form.clean("preview_token").and_then(|token| {+ token+ .parse::<AdminUserMessageShredRequestPreviewToken>()+ .ok()+ }) else {+ return DispatchOutcome::error("Preview the messages before you delete them.");+ };let basis = match basis_from_form(form) {Ok(basis) => basis,Err(message) => return DispatchOutcome::error(message),};- match client.queue_message_shred(user_id, entries, &basis).await {+ let entries = entries+ .into_iter()+ .map(+ |(channel_id, message_id)| AdminUserMessageShredRequestEntriesItem {+ channel_id: snowflake(&channel_id),+ message_id: snowflake(&message_id),+ },+ )+ .collect();+ match client+ .queue_message_shred(user_id, entries, &basis, preview_token)+ .await+ {Ok(response) => DispatchOutcome {flash: FlashData::success(removal_message("Message shred queued",@@ -660,34 +678,59 @@ fn parse_dry_run(value: Option<&str>) -> bool {!matches!(value.map(|value| value.trim().to_ascii_lowercase()), Some(value) if value == "false" || value == "0")}-fn parse_message_shred_csv(- csv: &str,-) -> Result<Vec<AdminUserMessageShredRequestEntriesItem>, String> {+pub(super) fn message_shred_entries(csv: &str) -> Result<Vec<(String, String)>, String> {+ let entries = parse_message_shred_csv(csv)?;+ if entries.is_empty() {+ return Err("The CSV has no channel_id,message_id rows.".to_owned());+ }+ Ok(entries)+}++fn parse_message_shred_csv(csv: &str) -> Result<Vec<(String, String)>, String> {let mut entries = Vec::new();- for line in csv.trim().lines() {+ for line in csv.trim_start_matches('\u{feff}').lines() {let trimmed = line.trim();- if trimmed.is_empty() || trimmed.eq_ignore_ascii_case("channel_id,message_id") {+ if trimmed.is_empty() {continue;}- let parts: Vec<&str> = trimmed.split(',').collect();+ let parts: Vec<&str> = trimmed.split(',').map(unquote).collect();if parts.len() != 2 {return Err("Each row must contain channel_id and message_id separated by a comma".to_owned(),);}- entries.push(AdminUserMessageShredRequestEntriesItem {- channel_id: snowflake(&parse_csv_snowflake(parts[0], "channel_id", trimmed)?),- message_id: snowflake(&parse_csv_snowflake(parts[1], "message_id", trimmed)?),- });+ if parts[0].eq_ignore_ascii_case("channel_id")+ && parts[1].eq_ignore_ascii_case("message_id")+ {+ continue;+ }+ entries.push((+ parse_csv_snowflake(parts[0], "channel_id", trimmed)?,+ parse_csv_snowflake(parts[1], "message_id", trimmed)?,+ ));}Ok(entries)}+fn unquote(value: &str) -> &str {+ let value = value.trim();+ value+ .strip_prefix('"')+ .and_then(|inner| inner.strip_suffix('"'))+ .unwrap_or(value)+ .trim()+}+fn parse_csv_snowflake(value: &str, field: &str, row: &str) -> Result<String, String> {let trimmed = value.trim();if trimmed.is_empty() {return Err(format!("Invalid row format: {row}"));}+ if !trimmed.bytes().all(|byte| byte.is_ascii_digit()) {+ return Err(format!(+ "Invalid {field} on row: {row}. IDs must be whole numbers. A spreadsheet can round long IDs, so export them as text."+ ));+ }match trimmed.parse::<u64>() {Ok(parsed) => Ok(parsed.to_string()),Err(_) => Err(format!("Invalid {field} on row: {row}")),diff --git a/fluxer_admin/src/routes/users.rs b/fluxer_admin/src/routes/users.rsindex 39c644a37..0440c3f2d 100644--- a/fluxer_admin/src/routes/users.rs+++ b/fluxer_admin/src/routes/users.rs@@ -4,6 +4,7 @@ use crate::{acl,api::{client::{AdminApiClient, ApiResult, ApiResultExt},+ generated::{snowflake, types::AdminUserMessageShredPreviewRequestEntriesItem},types::AdminUser,},middleware::{auth::AuthContext, csrf::CsrfToken, flash, htmx},@@ -11,8 +12,9 @@ use crate::{state::AppState,templates::{self,- pages::user_detail_tabs::account::{- PASSWORD_RESET_LINK_RESULT_ID, password_reset_link_result,+ pages::user_detail_tabs::{+ account::{PASSWORD_RESET_LINK_RESULT_ID, password_reset_link_result},+ moderation::{MESSAGE_SHRED_PREVIEW_ID, message_shred_preview},},},utils::forms::MultiValueForm,@@ -228,6 +230,9 @@ async fn user_detail_post(return create_password_reset_link(&state, &headers, &auth.0, &csrf.0.0, &client, &user_id).await;}+ if action == "preview_message_shred" {+ return preview_message_shred(&headers, &client, &user_id, &form).await;+ }let outcome = super::user_actions::dispatch(&client, &user_id, action, &form).await;let mut redirect = if tab.is_empty() {format!("{base}/users/{user_id}")@@ -244,6 +249,45 @@ async fn user_detail_post(flash::redirect_with_flash(&redirect, outcome.flash, config.secure_cookies())}+async fn preview_message_shred(+ headers: &HeaderMap,+ client: &AdminApiClient,+ user_id: &str,+ form: &MultiValueForm,+) -> Response {+ if !htmx::is_htmx_request(headers) || !htmx::targets(headers, MESSAGE_SHRED_PREVIEW_ID) {+ return htmx::toast_response(&flash::FlashData::error(+ "Previewing a message shred needs JavaScript.",+ ));+ }+ let entries = match super::user_actions::message_shred_entries(+ form.first("csv_data").unwrap_or_default(),+ ) {+ Ok(entries) => entries,+ Err(error) => return htmx::toast_response(&flash::FlashData::error(error)),+ };+ let entries = entries+ .into_iter()+ .map(+ |(channel_id, message_id)| AdminUserMessageShredPreviewRequestEntriesItem {+ channel_id: snowflake(&channel_id),+ message_id: snowflake(&message_id),+ },+ )+ .collect();+ match client.preview_message_shred(user_id, entries).await {+ Ok(preview) => Html(message_shred_preview(&preview).into_string()).into_response(),+ Err(error) => {+ tracing::warn!(%error, user_id, "admin API request failed: preview message shred");+ let message = match error.detail_message() {+ Some(detail) => format!("Failed to preview the messages: {detail}"),+ None => "Failed to preview the messages".to_owned(),+ };+ htmx::toast_response(&flash::FlashData::error(message))+ }+ }+}+async fn create_password_reset_link(state: &AppState,headers: &HeaderMap,diff --git a/fluxer_admin/src/templates/pages/user_detail_tabs/moderation.rs b/fluxer_admin/src/templates/pages/user_detail_tabs/moderation.rsindex 51aa9bf2b..0e5a92f32 100644--- a/fluxer_admin/src/templates/pages/user_detail_tabs/moderation.rs+++ b/fluxer_admin/src/templates/pages/user_detail_tabs/moderation.rs@@ -8,7 +8,8 @@ use crate::{client::{ApiError, ApiResult},generated::types::{EnforcementDecisionListResponse, EnforcementDecisionListResponseDecisionsItem,- EnforcementKindType, NetworkBlockCandidatesResponse,+ EnforcementKindType, MessageShredPreviewResponse,+ MessageShredPreviewResponseSkippedItemReason, NetworkBlockCandidatesResponse,},types::{AdminUser, AuditLogEntry, MessageShredStatusResponse},},@@ -671,13 +672,15 @@ fn message_shred_card((card_with_header("Message shredder", html! {div class="space-y-4" {p class="text-sm text-neutral-600" {- "Upload a CSV file with one channel_id,message_id pair per row. When a rule was broken, the first 50 messages are saved as evidence before they are removed, and every message for child safety and violent extremism reasons."+ "Upload a CSV file with one channel_id,message_id pair per row. You see exactly which messages will be deleted before anything is deleted. When a rule was broken, the first 50 messages are saved as evidence before they are removed, and every message for child safety and violent extremism reasons."}form method="post"action={(base) "/users/" (user.id) "?action=message_shred&tab=moderation"}+ data-preview-action={(base) "/users/" (user.id) "?action=preview_message_shred&tab=moderation"}id="message-shred-form" {(csrf_input(csrf_token))input type="hidden" name="csv_data" id="message-shred-csv-data";+ input type="hidden" name="preview_token" id="message-shred-preview-token";div class="space-y-4" {div class="space-y-2" {(field_label("message-shred-file", "CSV file"))@@ -693,11 +696,12 @@ fn message_shred_card(}}}+ div id=(MESSAGE_SHRED_PREVIEW_ID) {}(basis_fields(&content_basis_fields("shred", user, prefill, true)))button type="submit"id="message-shred-submit"class="inline-flex w-full items-center justify-center gap-2 rounded-lg bg-neutral-900 px-4 py-2 text-base font-medium text-white transition-all duration-150 hover:bg-neutral-800 focus:outline-none focus:ring-2 focus:ring-neutral-900 focus:ring-offset-2 focus:ring-offset-white disabled:cursor-not-allowed disabled:opacity-50" {- span { "Shred messages" }+ span { "Preview messages" }}}}@@ -708,6 +712,87 @@ fn message_shred_card(}}+pub const MESSAGE_SHRED_PREVIEW_ID: &str = "message-shred-preview";+const MESSAGE_SHRED_PREVIEW_ROWS: usize = 200;++pub fn message_shred_preview(preview: &MessageShredPreviewResponse) -> Markup {+ let count = u64::try_from(*preview.message_count).unwrap_or_default();+ let requested = u64::try_from(*preview.requested).unwrap_or_default();+ let hidden = preview+ .messages+ .len()+ .saturating_sub(MESSAGE_SHRED_PREVIEW_ROWS);+ html! {+ div class="space-y-3 rounded-lg border border-neutral-200 bg-neutral-50 p-4"+ data-preview-token=(preview.preview_token)+ data-message-count=(count) {+ p class="text-sm font-medium text-neutral-900" {+ @if count == 0 {+ "None of the " (count_noun(requested, "entry", "entries")) " match a message this user sent. Nothing would be deleted."+ } @else {+ (count_noun(count, "message", "messages")) " will be deleted. Nothing has been deleted yet."+ }+ }+ @if !preview.messages.is_empty() {+ div class="max-h-96 overflow-auto rounded border border-neutral-200 bg-white" {+ table class="w-full text-left text-xs" {+ thead class="bg-neutral-100 text-neutral-600" {+ tr {+ th class="px-2 py-1" { "Sent" }+ th class="px-2 py-1" { "Channel" }+ th class="px-2 py-1" { "Message" }+ th class="px-2 py-1" { "Content" }+ }+ }+ tbody {+ @for message in preview.messages.iter().take(MESSAGE_SHRED_PREVIEW_ROWS) {+ tr class="border-t border-neutral-100 align-top" {+ td class="whitespace-nowrap px-2 py-1" { (format_admin_timestamp(&message.timestamp)) }+ td class="px-2 py-1 font-mono" { (message.channel_id.as_str()) }+ td class="px-2 py-1 font-mono" { (message.message_id.as_str()) }+ td class="px-2 py-1 break-words" {+ (message.content)+ @let attachments = u64::try_from(*message.attachment_count).unwrap_or_default();+ @if attachments > 0 {+ span class="text-neutral-500" { " (" (count_noun(attachments, "attachment", "attachments")) ")" }+ }+ }+ }+ }+ }+ }+ }+ @if hidden > 0 {+ p class="text-xs text-neutral-500" { "And " (count_noun(hidden as u64, "more message", "more messages")) "." }+ }+ }+ @if !preview.skipped.is_empty() {+ details class="text-sm text-neutral-700" {+ summary class="cursor-pointer" {+ (count_noun(preview.skipped.len() as u64, "entry", "entries")) " will be left alone"+ }+ ul class="mt-2 space-y-1 text-xs" {+ @for entry in &preview.skipped {+ li class="font-mono" {+ (entry.channel_id.as_str()) "," (entry.message_id.as_str()) " "+ span class="font-sans text-neutral-500" { (skipped_reason_label(&entry.reason)) }+ }+ }+ }+ }+ }+ }+ }+}++fn skipped_reason_label(reason: &MessageShredPreviewResponseSkippedItemReason) -> &'static str {+ match reason {+ MessageShredPreviewResponseSkippedItemReason::NotFound => "not found in that channel",+ MessageShredPreviewResponseSkippedItemReason::OtherAuthor => "sent by someone else",+ MessageShredPreviewResponseSkippedItemReason::Duplicate => "listed twice",+ }+}+fn message_shred_status_section(base: &str,user: &AdminUser,@@ -851,9 +936,11 @@ const MESSAGE_SHRED_FORM_SCRIPT: &str = r#"if (!form) return;var file = document.getElementById('message-shred-file');var csvInput = document.getElementById('message-shred-csv-data');+ var tokenInput = document.getElementById('message-shred-preview-token');+ var preview = document.getElementById('message-shred-preview');var submitButton = document.getElementById('message-shred-submit');var fileName = document.getElementById('message-shred-file-name');- if (!file || !csvInput || !submitButton) return;+ if (!file || !csvInput || !tokenInput || !preview || !submitButton) return;var processing = false;function toast(level, message) {document.body.dispatchEvent(new CustomEvent('showFlash', {detail: {level: level, message: message}}));@@ -875,10 +962,16 @@ const MESSAGE_SHRED_FORM_SCRIPT: &str = r#"var input = form.querySelector('input[name="_csrf"]');return input ? input.value || '' : '';}- function resetSubmit(label) {+ function setButton(label) {processing = false;submitButton.disabled = false;- submitButton.querySelector('span').textContent = label || 'Shred messages';+ submitButton.querySelector('span').textContent = label;+ }+ function clearPreview() {+ tokenInput.value = '';+ csvInput.value = '';+ preview.innerHTML = '';+ setButton('Preview messages');}file.addEventListener('change', function () {if (fileName) {@@ -886,55 +979,71 @@ const MESSAGE_SHRED_FORM_SCRIPT: &str = r#"? file.files[0].name: 'No file chosen';}+ clearPreview();});form.addEventListener('submit', function (event) {if (processing) {event.preventDefault();return;}+ if (tokenInput.value && csvInput.value) {+ processing = true;+ submitButton.disabled = true;+ submitButton.querySelector('span').textContent = 'Deleting...';+ return;+ }+ event.preventDefault();var selected = file.files && file.files[0];if (!selected) {- event.preventDefault();toast('error', 'Please select a CSV file to continue.');return;}- event.preventDefault();processing = true;submitButton.disabled = true;- submitButton.querySelector('span').textContent = 'Processing...';+ submitButton.querySelector('span').textContent = 'Checking...';var reader = new FileReader();reader.onload = function () {csvInput.value = reader.result || '';- toast('info', 'Queueing message shred...');- fetch(form.getAttribute('action') || window.location.href, {+ var body = new URLSearchParams();+ body.set('_csrf', csrfToken());+ body.set('csv_data', csvInput.value);+ fetch(form.getAttribute('data-preview-action'), {method: 'POST',credentials: 'same-origin',headers: {'Content-Type': 'application/x-www-form-urlencoded','HX-Request': 'true',- 'HX-Target': 'flash-container',+ 'HX-Target': 'message-shred-preview','X-CSRF-Token': csrfToken()},- body: new URLSearchParams(new FormData(form)).toString()+ body: body.toString()}).then(function (response) {var parsed = toastFromResponse(response);- if (!response.ok && !parsed) throw new Error('Failed to queue message shred.');- toast(- parsed ? parsed.level : response.ok ? 'success' : 'error',- parsed ? parsed.message : response.ok ? 'Message shred queued.' : 'Failed to queue message shred.'- );- resetSubmit();- if (response.ok) {- file.value = '';- if (fileName) fileName.textContent = 'No file chosen';+ if (parsed) {+ toast(parsed.level, parsed.message);+ clearPreview();+ return;}+ if (!response.ok) throw new Error('Failed to preview the messages.');+ return response.text().then(function (html) {+ preview.innerHTML = html;+ var result = preview.firstElementChild;+ var count = result ? Number(result.getAttribute('data-message-count')) || 0 : 0;+ if (count > 0) {+ tokenInput.value = result.getAttribute('data-preview-token') || '';+ setButton(count === 1 ? 'Delete 1 message' : 'Delete ' + count + ' messages');+ } else {+ tokenInput.value = '';+ setButton('Preview messages');+ }+ });}).catch(function (error) {- toast('error', error && error.message ? error.message : 'Failed to queue message shred.');- resetSubmit();+ toast('error', error && error.message ? error.message : 'Failed to preview the messages.');+ clearPreview();});};reader.onerror = function () {- resetSubmit();+ clearPreview();toast('error', 'Failed to read the CSV file. Please try again.');};reader.readAsText(selected);diff --git a/fluxer_api/src/api/admin/AdminService.ts b/fluxer_api/src/api/admin/AdminService.tsindex 7925ab4e7..419c7f14c 100644--- a/fluxer_api/src/api/admin/AdminService.ts+++ b/fluxer_api/src/api/admin/AdminService.ts@@ -183,6 +183,7 @@ export class AdminService {});this.messageShredService = new AdminMessageShredService({apiContext: this.apiContext,+ channelRepository: this.channelRepository,auditService: this.auditService,enforcement: this.enforcementService,});diff --git a/fluxer_api/src/api/admin/controllers/MessageAdminController.ts b/fluxer_api/src/api/admin/controllers/MessageAdminController.tsindex fac137ddd..1732efb4d 100644--- a/fluxer_api/src/api/admin/controllers/MessageAdminController.ts+++ b/fluxer_api/src/api/admin/controllers/MessageAdminController.ts@@ -1,7 +1,7 @@// SPDX-License-Identifier: AGPL-3.0-or-laterimport {AdminAuditReadActions} from '@app/api/admin/AdminAuditActions';-import {recordAdminRead} from '@app/api/admin/AdminAuditRecorder';+import {recordAdminRead, recordAdminWrite} from '@app/api/admin/AdminAuditRecorder';import {createChannelID, createMessageID, createUserID} from '@app/api/BrandedTypes';import {enforcementActor} from '@app/api/enforcement/EnforcementActor';import {requireAdminACL} from '@app/api/middleware/AdminMiddleware';@@ -24,9 +24,11 @@ import {AdminMessageDetailQuery,AdminUserMessageDeleteQuery,AdminUserMessageDeleteRequest,+ AdminUserMessageShredPreviewRequest,AdminUserMessageShredRequest,DeleteAllUserMessagesResponse,MessageShredJobIdParam,+ MessageShredPreviewResponse,MessageShredResponse,} from '@fluxer/schema/src/domains/admin/AdminMessageSchemas';import {@@ -265,6 +267,42 @@ export function MessageAdminController(app: HonoApp) {);},);+ app.post(+ '/admin/users/:user_id/message-shreds/preview',+ RateLimitMiddleware(RateLimitConfigs.ADMIN_MESSAGE_OPERATION),+ requireAdminACL(AdminACLs.MESSAGE_SHRED),+ Validator('param', UserIdParam),+ Validator('json', AdminUserMessageShredPreviewRequest),+ OpenAPI({+ operationId: 'preview_admin_user_message_shred',+ summary: 'Preview a message shred',+ description:+ 'Lists exactly the messages a shred of these entries removes: entries the user sent in that channel. Entries that are missing, sent by someone else or listed twice are returned in skipped and are never removed. Pass preview_token with the shred to remove exactly these messages. Nothing is removed and no decision is recorded. Requires MESSAGE_SHRED permission.',+ responseSchema: MessageShredPreviewResponse,+ statusCode: 200,+ security: 'adminApiKey',+ tags: 'Admin',+ }),+ async (ctx) => {+ const {user_id} = ctx.req.valid('param');+ const body = ctx.req.valid('json');+ const preview = await ctx+ .get('adminService')+ .messageShredService.previewMessageShred(createUserID(user_id), body);+ await recordAdminWrite(ctx, {+ targetType: 'message_shred',+ targetId: user_id,+ action: 'preview_message_shred',+ metadata: {+ user_id,+ requested_entries: body.entries.length,+ message_count: preview.message_count,+ skipped_entries: preview.skipped.length,+ },+ });+ return ctx.json(preview);+ },+ );app.post('/admin/users/:user_id/message-shreds',RateLimitMiddleware(RateLimitConfigs.ADMIN_MESSAGE_OPERATION),@@ -275,7 +313,7 @@ export function MessageAdminController(app: HonoApp) {operationId: 'shred_admin_user_messages',summary: 'Shred user messages',description:- 'Queues bulk shredding of the given messages of a user, with attachment deletion. Returns a job ID to track progress asynchronously. With an enforcement basis the first 50 entries are snapshotted as the evidence of a content removal decision before the job is queued, every entry for child safety and violent extremism reasons, and the user is sent its notice. Requires MESSAGE_SHRED permission.',+ 'Queues bulk shredding of the given messages of a user, with attachment deletion. Only messages the user sent in the named channel are removed. With preview_token from the preview route, exactly the previewed messages are removed, and the request is refused with MESSAGE_SHRED_PREVIEW_CHANGED when they changed since. Returns a job ID to track progress asynchronously. With an enforcement basis the first 50 entries are snapshotted as the evidence of a content removal decision before the job is queued, every entry for child safety and violent extremism reasons, and the user is sent its notice. Requires MESSAGE_SHRED permission.',responseSchema: MessageShredResponse,statusCode: 200,security: 'adminApiKey',diff --git a/fluxer_api/src/api/admin/services/AdminMessageShredService.ts b/fluxer_api/src/api/admin/services/AdminMessageShredService.tsindex 85b07b7ba..75df5f3e9 100644--- a/fluxer_api/src/api/admin/services/AdminMessageShredService.ts+++ b/fluxer_api/src/api/admin/services/AdminMessageShredService.ts@@ -1,16 +1,23 @@// SPDX-License-Identifier: AGPL-3.0-or-later+import {createHash} from 'node:crypto';import type {ApiContext} from '@app/api/ApiContext';import type {AdminAuditService} from '@app/api/admin/services/AdminAuditService';-import type {UserID} from '@app/api/BrandedTypes';+import {createChannelID, createMessageID, type UserID} from '@app/api/BrandedTypes';+import type {ChannelRepository} from '@app/api/channel/ChannelRepository';import type {EnforcementDecisionRow} from '@app/api/database/types/EnforcementTypes';import type {EnforcementActor} from '@app/api/enforcement/EnforcementActor';import {decisionAuditMetadata, type EnforcementDecisionService} from '@app/api/enforcement/EnforcementDecisionService';import {Logger} from '@app/api/Logger';+import {ValidationErrorCodes} from '@fluxer/constants/src/ValidationErrorCodes';+import {InputValidationError} from '@fluxer/errors/src/domains/core/InputValidationError';import type {+ AdminUserMessageShredPreviewRequest,AdminUserMessageShredRequest,+ MessageShredPreviewResponse,MessageShredResponse,} from '@fluxer/schema/src/domains/admin/AdminMessageSchemas';+import {snowflakeToDate} from '@fluxer/snowflake/src/Snowflake';import type {WorkerJobPayload} from '@pkgs/worker/src/contracts/WorkerTypes';type MessageShredStatusCacheEntry = {@@ -30,8 +37,18 @@ type MessageShredStatusResult =status: 'not_found';};+type ShredEntry = {channel_id: bigint; message_id: bigint};++const PREVIEW_CONTENT_LENGTH = 200;++interface ShredPlan {+ deletable: Array<ShredEntry>;+ preview: MessageShredPreviewResponse;+}+interface AdminMessageShredServiceDeps {apiContext: ApiContext;+ channelRepository: ChannelRepository;auditService: AdminAuditService;enforcement: EnforcementDecisionService;}@@ -71,15 +88,83 @@ export async function queueMessageShredJob(return jobId;}+function previewToken(userId: UserID, deletable: ReadonlyArray<ShredEntry>): string {+ const hash = createHash('sha256').update(userId.toString());+ for (const entry of deletable) {+ hash.update(`\n${entry.channel_id}:${entry.message_id}`);+ }+ return hash.digest('hex');+}+export class AdminMessageShredService {constructor(private readonly deps: AdminMessageShredServiceDeps) {}+ private async plan(userId: UserID, entries: ReadonlyArray<ShredEntry>): Promise<ShredPlan> {+ const seen = new Set<string>();+ const deletable: Array<ShredEntry> = [];+ const messages: MessageShredPreviewResponse['messages'] = [];+ const skipped: MessageShredPreviewResponse['skipped'] = [];+ for (const entry of entries) {+ const ids = {channel_id: entry.channel_id.toString(), message_id: entry.message_id.toString()};+ const key = `${ids.channel_id}:${ids.message_id}`;+ if (seen.has(key)) {+ skipped.push({...ids, reason: 'duplicate'});+ continue;+ }+ seen.add(key);+ const message = await this.deps.channelRepository.messages.getMessage(+ createChannelID(entry.channel_id),+ createMessageID(entry.message_id),+ );+ if (!message || message.channelId !== entry.channel_id || message.id !== entry.message_id) {+ skipped.push({...ids, reason: 'not_found'});+ continue;+ }+ if (message.authorId !== userId) {+ skipped.push({...ids, reason: 'other_author'});+ continue;+ }+ deletable.push({channel_id: entry.channel_id, message_id: entry.message_id});+ messages.push({+ ...ids,+ timestamp: snowflakeToDate(entry.message_id).toISOString(),+ content: [...(message.content ?? '')].slice(0, PREVIEW_CONTENT_LENGTH).join(''),+ attachment_count: message.attachments?.length ?? 0,+ });+ }+ return {+ deletable,+ preview: {+ requested: entries.length,+ message_count: deletable.length,+ messages,+ skipped,+ preview_token: previewToken(userId, deletable),+ },+ };+ }++ async previewMessageShred(+ userId: UserID,+ {entries}: AdminUserMessageShredPreviewRequest,+ ): Promise<MessageShredPreviewResponse> {+ return (await this.plan(userId, entries)).preview;+ }+async queueMessageShred(userId: UserID,- {entries, basis}: AdminUserMessageShredRequest,+ {entries: requested, basis, preview_token}: AdminUserMessageShredRequest,actor: EnforcementActor,): Promise<MessageShredResponse> {const {apiContext, auditService, enforcement} = this.deps;+ let entries: ReadonlyArray<ShredEntry> = requested;+ if (preview_token !== undefined) {+ const {deletable, preview} = await this.plan(userId, requested);+ if (preview.preview_token !== preview_token || deletable.length === 0) {+ throw InputValidationError.fromCode('preview_token', ValidationErrorCodes.MESSAGE_SHRED_PREVIEW_CHANGED);+ }+ entries = deletable;+ }let jobId = '';const queue = async () => {jobId = await queueMessageShredJob(apiContext, actor.adminUserId, userId, entries);@@ -109,7 +194,8 @@ export class AdminMessageShredService {metadata: new Map([['user_id', userId.toString()],['job_id', jobId],- ['requested_entries', entries.length.toString()],+ ['requested_entries', requested.length.toString()],+ ...(preview_token === undefined ? [] : [['previewed_messages', entries.length.toString()] as [string, string]]),['basis', basis.type],...(decision ? decisionAuditMetadata(decision) : []),]),@@ -117,7 +203,7 @@ export class AdminMessageShredService {return {success: true,job_id: jobId,- requested: entries.length,+ requested: requested.length,...(decision ? {decision_id: decision.decision_id.toString()} : {}),};}diff --git a/fluxer_api/src/api/admin/tests/audit_coverage/MessageAdminAuditCases.ts b/fluxer_api/src/api/admin/tests/audit_coverage/MessageAdminAuditCases.tsindex 696a99302..78f22dfd6 100644--- a/fluxer_api/src/api/admin/tests/audit_coverage/MessageAdminAuditCases.ts+++ b/fluxer_api/src/api/admin/tests/audit_coverage/MessageAdminAuditCases.ts@@ -203,6 +203,26 @@ export const MessageAdminAuditCases: ReadonlyArray<AdminAuditCoverageCase> = [};},},+ {+ method: 'POST',+ route: '/admin/users/:user_id/message-shreds/preview',+ async prepare({harness}) {+ const {author, channelId} = await createAuthorChannel(harness);+ const message = await sendMessage(harness, author.token, channelId, 'shred target');+ return {+ request: {+ path: `/admin/users/${author.userId}/message-shreds/preview`,+ body: {entries: [{channel_id: channelId, message_id: message.id}]},+ },+ expected: {+ action: 'preview_message_shred',+ targetType: 'message_shred',+ targetId: author.userId,+ metadata: {user_id: author.userId, requested_entries: '1', message_count: '1', skipped_entries: '0'},+ },+ };+ },+ },{method: 'POST',route: '/admin/users/:user_id/message-shreds',diff --git a/fluxer_api/src/api/enforcement/EnforcementDecisionService.ts b/fluxer_api/src/api/enforcement/EnforcementDecisionService.tsindex 407dbcdbc..6df1d7664 100644--- a/fluxer_api/src/api/enforcement/EnforcementDecisionService.ts+++ b/fluxer_api/src/api/enforcement/EnforcementDecisionService.ts@@ -872,13 +872,15 @@ export class EnforcementDecisionService {const reports = await this.loadReports(reportIds, subject);const removed = removal?.type === 'messages' ? removal.entries : [];const snapshotted = reason.handling === 'restricted' ? removed.length : EVIDENCE_LIMIT;- const evidence = await collectEvidence({+ const collected = await collectEvidence({subject: evidenceSubject(subject),messages: removed.length > 0 ? removed.slice(0, snapshotted) : explicitEvidence,path: removed.length > 0 ? 'entries' : 'decision.evidence',reports,channelRepository: this.deps.channelRepository,});+ const removedIds = new Set(removed.map((entry) => entry.message_id));+ const evidence = removed.length > 0 ? collected.filter((message) => removedIds.has(message.message_id)) : collected;if (removeEvidence && evidence.length === 0) {throw InputValidationError.fromCode('remove_evidence', ValidationErrorCodes.ENFORCEMENT_EVIDENCE_REQUIRED);}diff --git a/fluxer_docs/src/content/docs/admin-api/index.mdx b/fluxer_docs/src/content/docs/admin-api/index.mdxindex a7fd82bf4..3991dc195 100644--- a/fluxer_docs/src/content/docs/admin-api/index.mdx+++ b/fluxer_docs/src/content/docs/admin-api/index.mdx@@ -436,6 +436,7 @@ These entries have `access` set to `write`.| link_sso_identity | A single sign-on subject was bound to an account by hand || migrate_sso_identities | Single sign-on subjects were moved from an earlier provider ID to the provider in use || move_badge | One custom badge was moved in the display order |+| preview_message_shred | The messages a shred would delete were listed || purge_asset | A stored media asset was purged || purge_guild_emoji_asset | A guild emoji asset was purged || purge_guild_sticker_asset | A guild sticker asset was purged |diff --git a/fluxer_docs/src/content/docs/admin-api/users.mdx b/fluxer_docs/src/content/docs/admin-api/users.mdxindex 62751eb62..bda8c4a1d 100644--- a/fluxer_docs/src/content/docs/admin-api/users.mdx+++ b/fluxer_docs/src/content/docs/admin-api/users.mdx@@ -1610,11 +1610,43 @@ Only `dry_run` set to `false`, `False` or `0` deletes messages, and any other vaThe rate limit is 100 requests per minute, on the `admin:message:operation` bucket.+## Preview user message shred++<RouteHeader method="POST" path="/v1/admin/users/{user_id}/message-shreds/preview" auditReason />++Lists exactly the messages a shred of these entries deletes, without deleting anything or recording a decision. You need `message:shred`. A message is listed only when the account sent it in the named channel. Missing messages, messages someone else sent and repeated entries are returned in `skipped`. Pass `preview_token` to [Shred user messages](#shred-user-messages) to delete exactly these messages.++### JSON body++| Field | Type | Description |+| --- | --- | --- |+| entries | array[[message shred entry](#message-shred-entry-object) object] | The messages to check (1-1000) |++### Response body++| Field | Type | Description |+| --- | --- | --- |+| requested | integer | How many entries you sent |+| message_count | integer | How many messages a shred deletes |+| messages | array[object] | Each message a shred deletes, with `channel_id`, `message_id`, `timestamp`, `content` and `attachment_count`<sup>1</sup> |+| skipped | array[object] | Each entry a shred leaves alone, with `channel_id`, `message_id` and a `reason` of `not_found`, `other_author` or `duplicate` |+| preview_token | string | Pass this with the shred |++<sup>1</sup> `content` holds the first 200 characters of the message++### Response++| Status | Body | Condition |+| --- | --- | --- |+| 200 | response body | The preview is ready |++The rate limit is 100 requests per minute, on the `admin:message:operation` bucket.+## Shred user messages<RouteHeader method="POST" path="/v1/admin/users/{user_id}/message-shreds" auditReason />-Queues a job that deletes the listed messages for good, with their reactions and attachments. You need `message:shred`. The job skips a message that is gone or isn't the account's, and you follow it with [Get message shred job](/admin-api/messages/#get-message-shred-job).+Queues a job that deletes the listed messages for good, with their reactions and attachments. You need `message:shred`. The job skips a message that is gone or isn't the account's, and you follow it with [Get message shred job](/admin-api/messages/#get-message-shred-job). [Preview](#preview-user-message-shred) the entries first to see exactly what is deleted.### JSON body@@ -1622,8 +1654,11 @@ Queues a job that deletes the listed messages for good, with their reactions and| --- | --- | --- || entries | array[[message shred entry](#message-shred-entry-object) object] | The messages to delete (1-1000) || basis<sup>1</sup> | [basis](/admin-api/enforcement/#basis) object | Why the messages are removed |+| preview_token?<sup>2</sup> | string | The `preview_token` from a preview of the same entries |++<sup>1</sup> The `enforcement` basis records a content removal [decision](/admin-api/enforcement/), saves the first 50 deleted messages as evidence and sends the notice-<sup>1</sup> The `enforcement` basis records a content removal [decision](/admin-api/enforcement/), saves the first 50 entries as evidence and sends the notice+<sup>2</sup> With a token, only the previewed messages are deleted, and the shred is refused with `MESSAGE_SHRED_PREVIEW_CHANGED` when they changed since the preview### Response body@@ -1639,7 +1674,7 @@ Queues a job that deletes the listed messages for good, with their reactions and| Status | Body | Condition || --- | --- | --- || 200 | response body | The job was queued |-| 400 | [error response](/admin-api/#error-response) | `INVALID_FORM_BODY` with a [decision validation code](/admin-api/enforcement/#validation) |+| 400 | [error response](/admin-api/#error-response) | `INVALID_FORM_BODY` with `MESSAGE_SHRED_PREVIEW_CHANGED` or a [decision validation code](/admin-api/enforcement/#validation) |The rate limit is 100 requests per minute, on the `admin:message:operation` bucket.diff --git a/fluxer_docs/src/content/docs/http-api/errors.md b/fluxer_docs/src/content/docs/http-api/errors.mdindex 482472165..b3687ea54 100644--- a/fluxer_docs/src/content/docs/http-api/errors.md+++ b/fluxer_docs/src/content/docs/http-api/errors.md@@ -582,6 +582,7 @@ These are the values of `code` inside `errors`.| `MESSAGE_HISTORY_CUTOFF_BEFORE_GUILD_CREATION` | Message history cutoff can't be before the community was created || `MESSAGE_HISTORY_CUTOFF_IN_FUTURE` | Message history cutoff can't be in the future || `MESSAGE_IDS_CANNOT_BE_EMPTY` | `message_ids` can't be empty |+| `MESSAGE_SHRED_PREVIEW_CHANGED` | These messages changed after the preview. Preview them again || `MODERATION_BASIS_REQUIRED` | Give a basis to delete the messages || `MULTIPLE_FILES_FOR_INDEX_NOT_ALLOWED` | Multiple files for index {index} aren't allowed || `MUST_AGREE_TO_TOS_AND_PRIVACY_POLICY` | You need to accept the terms of service to create an account |diff --git a/packages/constants/src/ValidationErrorCodes.ts b/packages/constants/src/ValidationErrorCodes.tsindex 604d9c35a..e1fa71c49 100644--- a/packages/constants/src/ValidationErrorCodes.ts+++ b/packages/constants/src/ValidationErrorCodes.ts@@ -176,6 +176,7 @@ export const ValidationErrorCodes = {MESSAGE_HISTORY_CUTOFF_BEFORE_GUILD_CREATION: 'MESSAGE_HISTORY_CUTOFF_BEFORE_GUILD_CREATION',MESSAGE_HISTORY_CUTOFF_IN_FUTURE: 'MESSAGE_HISTORY_CUTOFF_IN_FUTURE',MESSAGE_IDS_CANNOT_BE_EMPTY: 'MESSAGE_IDS_CANNOT_BE_EMPTY',+ MESSAGE_SHRED_PREVIEW_CHANGED: 'MESSAGE_SHRED_PREVIEW_CHANGED',MESSAGES_ARRAY_REQUIRED_AND_NOT_EMPTY: 'MESSAGES_ARRAY_REQUIRED_AND_NOT_EMPTY',MESSAGES_WITH_SNAPSHOTS_CANNOT_BE_EDITED: 'MESSAGES_WITH_SNAPSHOTS_CANNOT_BE_EDITED',MODERATION_BASIS_REQUIRED: 'MODERATION_BASIS_REQUIRED',diff --git a/packages/errors/src/i18n/ErrorCodeMappings.ts b/packages/errors/src/i18n/ErrorCodeMappings.tsindex d74a52158..08da152f4 100644--- a/packages/errors/src/i18n/ErrorCodeMappings.ts+++ b/packages/errors/src/i18n/ErrorCodeMappings.ts@@ -687,6 +687,7 @@ export const ErrorCodeToI18nKey = {'admin_and_system.enforcement_rights_holder_not_allowed',[ValidationErrorCodes.ENFORCEMENT_RIGHTS_HOLDER_REQUIRED]: 'admin_and_system.enforcement_rights_holder_required',[ValidationErrorCodes.ENFORCEMENT_STATEMENT_NOT_ALLOWED]: 'admin_and_system.enforcement_statement_not_allowed',+ [ValidationErrorCodes.MESSAGE_SHRED_PREVIEW_CHANGED]: 'admin_and_system.message_shred_preview_changed',[ValidationErrorCodes.MODERATION_BASIS_REQUIRED]: 'admin_and_system.moderation_basis_required',[ValidationErrorCodes.REPORT_OUTCOME_INVALID]: 'moderation_and_reports.report_outcome_invalid',[APIErrorCodes.VALIDATION_ERROR]: 'http.validation_error',diff --git a/packages/errors/src/i18n/ErrorI18nMessages.ts b/packages/errors/src/i18n/ErrorI18nMessages.tsindex 4b26af9a9..0267d77e6 100644--- a/packages/errors/src/i18n/ErrorI18nMessages.ts+++ b/packages/errors/src/i18n/ErrorI18nMessages.ts@@ -106,6 +106,7 @@ export const ERROR_I18N_MESSAGES = {'admin_and_system.invalid_timeout_value': 'Invalid timeout value.','admin_and_system.invalid_timestamp': 'Invalid timestamp.','admin_and_system.invalid_timezone_identifier': 'Invalid time zone identifier.',+ 'admin_and_system.message_shred_preview_changed': 'These messages changed after the preview. Preview them again.','admin_and_system.missing_acl': 'Missing ACL.','admin_and_system.moderation_basis_required': 'Give a basis to delete the messages.','admin_and_system.must_be_iso_timestamp': 'Must be a valid ISO timestamp.',diff --git a/packages/errors/src/i18n/weblate/locales/ar.json b/packages/errors/src/i18n/weblate/locales/ar.jsonindex ed638354b..f17cc1328 100644--- a/packages/errors/src/i18n/weblate/locales/ar.json+++ b/packages/errors/src/i18n/weblate/locales/ar.json@@ -81,6 +81,7 @@"admin_and_system.invalid_timeout_value": "قيمة المهلة غير صالحة.","admin_and_system.invalid_timestamp": "الطابع الزمني غير صالح.","admin_and_system.invalid_timezone_identifier": "معرف المنطقة الزمنية غير صالح.",+ "admin_and_system.message_shred_preview_changed": "تغيّرت هذه الرسائل بعد المعاينة. اعرضها مرة أخرى.","admin_and_system.missing_acl": "قائمة التحكم بالوصول مفقودة.","admin_and_system.moderation_basis_required": "حدّد أساسًا لحذف الرسائل.","admin_and_system.must_be_iso_timestamp": "يجب أن يكون طابعًا زمنيًا ISO صالحًا.",diff --git a/packages/errors/src/i18n/weblate/locales/bg.json b/packages/errors/src/i18n/weblate/locales/bg.jsonindex 7742455d4..fd6643054 100644--- a/packages/errors/src/i18n/weblate/locales/bg.json+++ b/packages/errors/src/i18n/weblate/locales/bg.json@@ -81,6 +81,7 @@"admin_and_system.invalid_timeout_value": "Невалидна стойност за изчакването.","admin_and_system.invalid_timestamp": "Невалиден времеви печат.","admin_and_system.invalid_timezone_identifier": "Невалиден идентификатор на часовата зона.",+ "admin_and_system.message_shred_preview_changed": "Тези съобщения са се променили след прегледа. Прегледайте ги отново.","admin_and_system.missing_acl": "Липсва ACL.","admin_and_system.moderation_basis_required": "Посочи основание за изтриването на съобщенията.","admin_and_system.must_be_iso_timestamp": "Трябва да е валиден ISO времеви печат.",diff --git a/packages/errors/src/i18n/weblate/locales/cs.json b/packages/errors/src/i18n/weblate/locales/cs.jsonindex 310511b2b..c8b10649d 100644--- a/packages/errors/src/i18n/weblate/locales/cs.json+++ b/packages/errors/src/i18n/weblate/locales/cs.json@@ -81,6 +81,7 @@"admin_and_system.invalid_timeout_value": "Neplatná hodnota časového limitu.","admin_and_system.invalid_timestamp": "Neplatné časové razítko.","admin_and_system.invalid_timezone_identifier": "Neplatný identifikátor časového pásma.",+ "admin_and_system.message_shred_preview_changed": "Tyto zprávy se po náhledu změnily. Zobrazte náhled znovu.","admin_and_system.missing_acl": "ACL chybí.","admin_and_system.moderation_basis_required": "Uveďte základ pro smazání zpráv.","admin_and_system.must_be_iso_timestamp": "Je vyžadováno platné časové razítko ve formátu ISO.",diff --git a/packages/errors/src/i18n/weblate/locales/da.json b/packages/errors/src/i18n/weblate/locales/da.jsonindex 5e52b4ab1..dddd75541 100644--- a/packages/errors/src/i18n/weblate/locales/da.json+++ b/packages/errors/src/i18n/weblate/locales/da.json@@ -81,6 +81,7 @@"admin_and_system.invalid_timeout_value": "Ugyldig timeout-værdi.","admin_and_system.invalid_timestamp": "Ugyldigt tidsstempel.","admin_and_system.invalid_timezone_identifier": "Ugyldig tidszoneidentifikator.",+ "admin_and_system.message_shred_preview_changed": "Disse beskeder er ændret efter forhåndsvisningen. Forhåndsvis dem igen.","admin_and_system.missing_acl": "Manglende ACL.","admin_and_system.moderation_basis_required": "Angiv et grundlag for at slette beskederne.","admin_and_system.must_be_iso_timestamp": "Skal være et gyldigt ISO-tidsstempel.",diff --git a/packages/errors/src/i18n/weblate/locales/de.json b/packages/errors/src/i18n/weblate/locales/de.jsonindex 7dcdb977f..f021c3921 100644--- a/packages/errors/src/i18n/weblate/locales/de.json+++ b/packages/errors/src/i18n/weblate/locales/de.json@@ -81,6 +81,7 @@"admin_and_system.invalid_timeout_value": "Ungültiger Timeout-Wert.","admin_and_system.invalid_timestamp": "Ungültiger Zeitstempel.","admin_and_system.invalid_timezone_identifier": "Ungültige Zeitzonen-ID.",+ "admin_and_system.message_shred_preview_changed": "Diese Nachrichten haben sich nach der Vorschau geändert. Zeig die Vorschau erneut an.","admin_and_system.missing_acl": "ACL fehlt.","admin_and_system.moderation_basis_required": "Gib eine Grundlage an, um die Nachrichten zu löschen.","admin_and_system.must_be_iso_timestamp": "Es muss ein gültiger ISO-Zeitstempel sein.",diff --git a/packages/errors/src/i18n/weblate/locales/el.json b/packages/errors/src/i18n/weblate/locales/el.jsonindex c073a0e9e..41e2fd291 100644--- a/packages/errors/src/i18n/weblate/locales/el.json+++ b/packages/errors/src/i18n/weblate/locales/el.json@@ -81,6 +81,7 @@"admin_and_system.invalid_timeout_value": "Μη έγκυρη τιμή χρονικού ορίου.","admin_and_system.invalid_timestamp": "Μη έγκυρη χρονική σήμανση.","admin_and_system.invalid_timezone_identifier": "Μη έγκυρο αναγνωριστικό ζώνης ώρας.",+ "admin_and_system.message_shred_preview_changed": "Αυτά τα μηνύματα άλλαξαν μετά την προεπισκόπηση. Κάνε ξανά προεπισκόπηση.","admin_and_system.missing_acl": "Λείπει ACL.","admin_and_system.moderation_basis_required": "Δώσε μια βάση για τη διαγραφή των μηνυμάτων.","admin_and_system.must_be_iso_timestamp": "Πρέπει να είναι έγκυρη χρονική σήμανση ISO.",diff --git a/packages/errors/src/i18n/weblate/locales/en-GB.json b/packages/errors/src/i18n/weblate/locales/en-GB.jsonindex cfaf15485..cf316dd56 100644--- a/packages/errors/src/i18n/weblate/locales/en-GB.json+++ b/packages/errors/src/i18n/weblate/locales/en-GB.json@@ -81,6 +81,7 @@"admin_and_system.invalid_timeout_value": "Invalid timeout value.","admin_and_system.invalid_timestamp": "Invalid timestamp.","admin_and_system.invalid_timezone_identifier": "Invalid time zone identifier.",+ "admin_and_system.message_shred_preview_changed": "These messages changed after the preview. Preview them again.","admin_and_system.missing_acl": "Missing ACL.","admin_and_system.moderation_basis_required": "Give a basis to delete the messages.","admin_and_system.must_be_iso_timestamp": "Must be a valid ISO timestamp.",diff --git a/packages/errors/src/i18n/weblate/locales/es-419.json b/packages/errors/src/i18n/weblate/locales/es-419.jsonindex 6d2c3b734..9e905a87f 100644--- a/packages/errors/src/i18n/weblate/locales/es-419.json+++ b/packages/errors/src/i18n/weblate/locales/es-419.json@@ -81,6 +81,7 @@"admin_and_system.invalid_timeout_value": "Fecha de fin del aislamiento temporal inválida.","admin_and_system.invalid_timestamp": "Marca de tiempo inválida.","admin_and_system.invalid_timezone_identifier": "Identificador de zona horaria inválido.",+ "admin_and_system.message_shred_preview_changed": "Estos mensajes cambiaron después de la vista previa. Vuelve a generar la vista previa.","admin_and_system.missing_acl": "Falta ACL.","admin_and_system.moderation_basis_required": "Indica un fundamento para eliminar los mensajes.","admin_and_system.must_be_iso_timestamp": "Debe ser una marca de tiempo ISO válida.",diff --git a/packages/errors/src/i18n/weblate/locales/es-ES.json b/packages/errors/src/i18n/weblate/locales/es-ES.jsonindex 0cdec8e2c..a9b4c57f1 100644--- a/packages/errors/src/i18n/weblate/locales/es-ES.json+++ b/packages/errors/src/i18n/weblate/locales/es-ES.json@@ -81,6 +81,7 @@"admin_and_system.invalid_timeout_value": "Fecha de fin del aislamiento temporal no válida.","admin_and_system.invalid_timestamp": "Marca de tiempo no válida.","admin_and_system.invalid_timezone_identifier": "Identificador de zona horaria no válido.",+ "admin_and_system.message_shred_preview_changed": "Estos mensajes han cambiado después de la vista previa. Vuelve a generar la vista previa.","admin_and_system.missing_acl": "Falta la ACL.","admin_and_system.moderation_basis_required": "Indica un fundamento para eliminar los mensajes.","admin_and_system.must_be_iso_timestamp": "Debe ser una marca de tiempo ISO válida.",diff --git a/packages/errors/src/i18n/weblate/locales/fi.json b/packages/errors/src/i18n/weblate/locales/fi.jsonindex 39b4aecb8..1c2c0d63f 100644--- a/packages/errors/src/i18n/weblate/locales/fi.json+++ b/packages/errors/src/i18n/weblate/locales/fi.json@@ -81,6 +81,7 @@"admin_and_system.invalid_timeout_value": "Virheellinen aikakatkaisuarvo.","admin_and_system.invalid_timestamp": "Virheellinen aikaleima.","admin_and_system.invalid_timezone_identifier": "Virheellinen aikavyöhyketunnus.",+ "admin_and_system.message_shred_preview_changed": "Nämä viestit muuttuivat esikatselun jälkeen. Esikatsele ne uudelleen.","admin_and_system.missing_acl": "ACL puuttuu.","admin_and_system.moderation_basis_required": "Anna peruste viestien poistamiselle.","admin_and_system.must_be_iso_timestamp": "On oltava kelvollinen ISO-aikaleima.",diff --git a/packages/errors/src/i18n/weblate/locales/fr.json b/packages/errors/src/i18n/weblate/locales/fr.jsonindex 5c3f9c19a..33ffc2794 100644--- a/packages/errors/src/i18n/weblate/locales/fr.json+++ b/packages/errors/src/i18n/weblate/locales/fr.json@@ -81,6 +81,7 @@"admin_and_system.invalid_timeout_value": "Date de fin de restriction temporaire non valide.","admin_and_system.invalid_timestamp": "Horodatage invalide.","admin_and_system.invalid_timezone_identifier": "Identifiant de fuseau horaire invalide.",+ "admin_and_system.message_shred_preview_changed": "Ces messages ont changé après l’aperçu. Relance l’aperçu.","admin_and_system.missing_acl": "Liste de contrôle d'accès manquante.","admin_and_system.moderation_basis_required": "Indiquez un fondement pour supprimer les messages.","admin_and_system.must_be_iso_timestamp": "Doit être un horodatage ISO valide.",diff --git a/packages/errors/src/i18n/weblate/locales/he.json b/packages/errors/src/i18n/weblate/locales/he.jsonindex d600d80fa..c19eb1f48 100644--- a/packages/errors/src/i18n/weblate/locales/he.json+++ b/packages/errors/src/i18n/weblate/locales/he.json@@ -81,6 +81,7 @@"admin_and_system.invalid_timeout_value": "ערך פסק זמן שגוי.","admin_and_system.invalid_timestamp": "חותמת זמן שגויה.","admin_and_system.invalid_timezone_identifier": "מזהה אזור זמן שגוי.",+ "admin_and_system.message_shred_preview_changed": "ההודעות האלה השתנו אחרי התצוגה המקדימה. יש להציג אותן שוב.","admin_and_system.missing_acl": "ACL חסר.","admin_and_system.moderation_basis_required": "יש לציין בסיס למחיקת ההודעות.","admin_and_system.must_be_iso_timestamp": "חייבת להיות חותמת זמן ISO תקינה.",diff --git a/packages/errors/src/i18n/weblate/locales/hi.json b/packages/errors/src/i18n/weblate/locales/hi.jsonindex 8ec4c7219..f8cc535c2 100644--- a/packages/errors/src/i18n/weblate/locales/hi.json+++ b/packages/errors/src/i18n/weblate/locales/hi.json@@ -81,6 +81,7 @@"admin_and_system.invalid_timeout_value": "अमान्य टाइमआउट वैल्यू।","admin_and_system.invalid_timestamp": "अमान्य टाइमस्टैम्प।","admin_and_system.invalid_timezone_identifier": "अमान्य टाइमज़ोन आइडेंटिफ़ायर।",+ "admin_and_system.message_shred_preview_changed": "पूर्वावलोकन के बाद ये संदेश बदल गए। इनका फिर से पूर्वावलोकन करें।","admin_and_system.missing_acl": "ACL गायब है।","admin_and_system.moderation_basis_required": "मैसेज डिलीट करने का आधार बताएँ।","admin_and_system.must_be_iso_timestamp": "मान्य ISO टाइमस्टैम्प होना ज़रूरी है।",diff --git a/packages/errors/src/i18n/weblate/locales/hr.json b/packages/errors/src/i18n/weblate/locales/hr.jsonindex d66df8a5c..38c11c23d 100644--- a/packages/errors/src/i18n/weblate/locales/hr.json+++ b/packages/errors/src/i18n/weblate/locales/hr.json@@ -81,6 +81,7 @@"admin_and_system.invalid_timeout_value": "Nevažeća vrijednost za istek vremena.","admin_and_system.invalid_timestamp": "Nevažeća vremenska oznaka.","admin_and_system.invalid_timezone_identifier": "Nevažeći identifikator vremenske zone.",+ "admin_and_system.message_shred_preview_changed": "Ove su se poruke promijenile nakon pregleda. Ponovno ih pregledaj.","admin_and_system.missing_acl": "Nedostaje ACL.","admin_and_system.moderation_basis_required": "Navedi osnovu za brisanje poruka.","admin_and_system.must_be_iso_timestamp": "Mora biti valjana ISO vremenska oznaka.",diff --git a/packages/errors/src/i18n/weblate/locales/hu.json b/packages/errors/src/i18n/weblate/locales/hu.jsonindex 3cf69121f..a0283a59e 100644--- a/packages/errors/src/i18n/weblate/locales/hu.json+++ b/packages/errors/src/i18n/weblate/locales/hu.json@@ -81,6 +81,7 @@"admin_and_system.invalid_timeout_value": "Érvénytelen időtúllépési idő.","admin_and_system.invalid_timestamp": "Érvénytelen időbélyeg.","admin_and_system.invalid_timezone_identifier": "Érvénytelen időzóna-azonosító.",+ "admin_and_system.message_shred_preview_changed": "Ezek az üzenetek az előnézet után megváltoztak. Kérj új előnézetet.","admin_and_system.missing_acl": "Hiányzó ACL.","admin_and_system.moderation_basis_required": "Add meg az üzenetek törlésének alapját.","admin_and_system.must_be_iso_timestamp": "Érvényes ISO-időbélyegnek kell lennie.",diff --git a/packages/errors/src/i18n/weblate/locales/id.json b/packages/errors/src/i18n/weblate/locales/id.jsonindex 138daf509..18c0e7a4a 100644--- a/packages/errors/src/i18n/weblate/locales/id.json+++ b/packages/errors/src/i18n/weblate/locales/id.json@@ -81,6 +81,7 @@"admin_and_system.invalid_timeout_value": "Nilai batas waktu tidak valid.","admin_and_system.invalid_timestamp": "Timestamp tidak valid.","admin_and_system.invalid_timezone_identifier": "Pengenal zona waktu tidak valid.",+ "admin_and_system.message_shred_preview_changed": "Pesan-pesan ini berubah setelah pratinjau. Pratinjau lagi.","admin_and_system.missing_acl": "ACL tidak ada.","admin_and_system.moderation_basis_required": "Berikan dasar untuk menghapus pesan.","admin_and_system.must_be_iso_timestamp": "Harus berupa ISO timestamp yang valid.",diff --git a/packages/errors/src/i18n/weblate/locales/it.json b/packages/errors/src/i18n/weblate/locales/it.jsonindex ebdf5ba31..b82fb7b92 100644--- a/packages/errors/src/i18n/weblate/locales/it.json+++ b/packages/errors/src/i18n/weblate/locales/it.json@@ -81,6 +81,7 @@"admin_and_system.invalid_timeout_value": "Valore di timeout non valido.","admin_and_system.invalid_timestamp": "Timestamp non valido.","admin_and_system.invalid_timezone_identifier": "Identificatore del fuso orario non valido.",+ "admin_and_system.message_shred_preview_changed": "Questi messaggi sono cambiati dopo l’anteprima. Rigenera l’anteprima.","admin_and_system.missing_acl": "ACL assente.","admin_and_system.moderation_basis_required": "Indica un fondamento per eliminare i messaggi.","admin_and_system.must_be_iso_timestamp": "Deve essere un timestamp ISO valido.",diff --git a/packages/errors/src/i18n/weblate/locales/ja.json b/packages/errors/src/i18n/weblate/locales/ja.jsonindex 29b76dc84..36d400486 100644--- a/packages/errors/src/i18n/weblate/locales/ja.json+++ b/packages/errors/src/i18n/weblate/locales/ja.json@@ -81,6 +81,7 @@"admin_and_system.invalid_timeout_value": "タイムアウトの値が無効です。","admin_and_system.invalid_timestamp": "タイムスタンプが無効です。","admin_and_system.invalid_timezone_identifier": "タイムゾーンIDが無効です。",+ "admin_and_system.message_shred_preview_changed": "プレビューの後にこれらのメッセージが変更されました。もう一度プレビューしてください。","admin_and_system.missing_acl": "ACLがありません。","admin_and_system.moderation_basis_required": "メッセージを削除する根拠を指定してください。","admin_and_system.must_be_iso_timestamp": "有効なISOタイムスタンプである必要があります。",diff --git a/packages/errors/src/i18n/weblate/locales/ko.json b/packages/errors/src/i18n/weblate/locales/ko.jsonindex c03c11b10..713d0b6cb 100644--- a/packages/errors/src/i18n/weblate/locales/ko.json+++ b/packages/errors/src/i18n/weblate/locales/ko.json@@ -81,6 +81,7 @@"admin_and_system.invalid_timeout_value": "타임아웃 값이 유효하지 않아요.","admin_and_system.invalid_timestamp": "타임스탬프가 유효하지 않아요.","admin_and_system.invalid_timezone_identifier": "시간대 식별자가 유효하지 않아요.",+ "admin_and_system.message_shred_preview_changed": "미리보기 이후 이 메시지들이 변경되었습니다. 다시 미리보기하세요.","admin_and_system.missing_acl": "ACL이 누락되었어요.","admin_and_system.moderation_basis_required": "메시지를 삭제할 근거를 입력해 주세요.","admin_and_system.must_be_iso_timestamp": "유효한 ISO 타임스탬프여야 해요.",diff --git a/packages/errors/src/i18n/weblate/locales/lt.json b/packages/errors/src/i18n/weblate/locales/lt.jsonindex e6da64af6..e7ae27e9d 100644--- a/packages/errors/src/i18n/weblate/locales/lt.json+++ b/packages/errors/src/i18n/weblate/locales/lt.json@@ -81,6 +81,7 @@"admin_and_system.invalid_timeout_value": "Netinkama laiko intervalo reikšmė.","admin_and_system.invalid_timestamp": "Netinkama laiko žyma.","admin_and_system.invalid_timezone_identifier": "Netinkamas laiko juostos identifikatorius.",+ "admin_and_system.message_shred_preview_changed": "Po peržiūros šios žinutės pasikeitė. Peržiūrėkite jas iš naujo.","admin_and_system.missing_acl": "Nėra ACL.","admin_and_system.moderation_basis_required": "Nurodyk žinučių ištrynimo pagrindą.","admin_and_system.must_be_iso_timestamp": "Turi būti galiojanti ISO laiko žyma.",diff --git a/packages/errors/src/i18n/weblate/locales/nl.json b/packages/errors/src/i18n/weblate/locales/nl.jsonindex d2d412bf7..c36eaf45c 100644--- a/packages/errors/src/i18n/weblate/locales/nl.json+++ b/packages/errors/src/i18n/weblate/locales/nl.json@@ -81,6 +81,7 @@"admin_and_system.invalid_timeout_value": "Ongeldige time-outwaarde.","admin_and_system.invalid_timestamp": "Ongeldige tijdstempel.","admin_and_system.invalid_timezone_identifier": "Ongeldige tijdzone-ID.",+ "admin_and_system.message_shred_preview_changed": "Deze berichten zijn gewijzigd na de voorvertoning. Bekijk ze opnieuw.","admin_and_system.missing_acl": "Een ACL ontbreekt.","admin_and_system.moderation_basis_required": "Geef een grondslag op om de berichten te verwijderen.","admin_and_system.must_be_iso_timestamp": "Moet een geldige ISO-tijdstempel zijn.",diff --git a/packages/errors/src/i18n/weblate/locales/no.json b/packages/errors/src/i18n/weblate/locales/no.jsonindex c67fb6840..2a3de1800 100644--- a/packages/errors/src/i18n/weblate/locales/no.json+++ b/packages/errors/src/i18n/weblate/locales/no.json@@ -81,6 +81,7 @@"admin_and_system.invalid_timeout_value": "Ugyldig tidsavbruddsverdi.","admin_and_system.invalid_timestamp": "Ugyldig tidsstempel.","admin_and_system.invalid_timezone_identifier": "Ugyldig tidssoneidentifikator.",+ "admin_and_system.message_shred_preview_changed": "Disse meldingene endret seg etter forhåndsvisningen. Forhåndsvis dem på nytt.","admin_and_system.missing_acl": "ACL mangler.","admin_and_system.moderation_basis_required": "Oppgi et grunnlag for å slette meldingene.","admin_and_system.must_be_iso_timestamp": "Må være et gyldig ISO-tidsstempel.",diff --git a/packages/errors/src/i18n/weblate/locales/pl.json b/packages/errors/src/i18n/weblate/locales/pl.jsonindex 4e76a9b5b..b826e7626 100644--- a/packages/errors/src/i18n/weblate/locales/pl.json+++ b/packages/errors/src/i18n/weblate/locales/pl.json@@ -81,6 +81,7 @@"admin_and_system.invalid_timeout_value": "Nieprawidłowa wartość limitu czasu.","admin_and_system.invalid_timestamp": "Nieprawidłowy znacznik czasu.","admin_and_system.invalid_timezone_identifier": "Nieprawidłowy identyfikator strefy czasowej.",+ "admin_and_system.message_shred_preview_changed": "Te wiadomości zmieniły się po podglądzie. Wyświetl podgląd ponownie.","admin_and_system.missing_acl": "Brak ACL-a.","admin_and_system.moderation_basis_required": "Podaj podstawę usunięcia wiadomości.","admin_and_system.must_be_iso_timestamp": "Wymagany prawidłowy znacznik czasu ISO.",diff --git a/packages/errors/src/i18n/weblate/locales/pt-BR.json b/packages/errors/src/i18n/weblate/locales/pt-BR.jsonindex 50b7ef73e..eaa75b074 100644--- a/packages/errors/src/i18n/weblate/locales/pt-BR.json+++ b/packages/errors/src/i18n/weblate/locales/pt-BR.json@@ -81,6 +81,7 @@"admin_and_system.invalid_timeout_value": "Data de término da suspensão temporária inválida.","admin_and_system.invalid_timestamp": "Timestamp inválido.","admin_and_system.invalid_timezone_identifier": "Identificador de fuso horário inválido.",+ "admin_and_system.message_shred_preview_changed": "Essas mensagens mudaram depois da prévia. Gere a prévia de novo.","admin_and_system.missing_acl": "ACL ausente.","admin_and_system.moderation_basis_required": "Informe um fundamento para excluir as mensagens.","admin_and_system.must_be_iso_timestamp": "Deve ser um timestamp ISO válido.",diff --git a/packages/errors/src/i18n/weblate/locales/ro.json b/packages/errors/src/i18n/weblate/locales/ro.jsonindex 9d947896f..aace0228d 100644--- a/packages/errors/src/i18n/weblate/locales/ro.json+++ b/packages/errors/src/i18n/weblate/locales/ro.json@@ -81,6 +81,7 @@"admin_and_system.invalid_timeout_value": "Valoarea de timeout este invalidă.","admin_and_system.invalid_timestamp": "Marca de timp este invalidă.","admin_and_system.invalid_timezone_identifier": "Identificatorul de fus orar este invalid.",+ "admin_and_system.message_shred_preview_changed": "Aceste mesaje s-au schimbat după previzualizare. Previzualizează-le din nou.","admin_and_system.missing_acl": "ACL lipsă.","admin_and_system.moderation_basis_required": "Indică un temei pentru ștergerea mesajelor.","admin_and_system.must_be_iso_timestamp": "Trebuie să fie o marcă de timp ISO validă.",diff --git a/packages/errors/src/i18n/weblate/locales/ru.json b/packages/errors/src/i18n/weblate/locales/ru.jsonindex 276c85d1b..9bcab74a8 100644--- a/packages/errors/src/i18n/weblate/locales/ru.json+++ b/packages/errors/src/i18n/weblate/locales/ru.json@@ -81,6 +81,7 @@"admin_and_system.invalid_timeout_value": "Неверное значение тайм-аута.","admin_and_system.invalid_timestamp": "Неверная метка времени.","admin_and_system.invalid_timezone_identifier": "Неверный идентификатор часового пояса.",+ "admin_and_system.message_shred_preview_changed": "Эти сообщения изменились после предпросмотра. Откройте предпросмотр ещё раз.","admin_and_system.missing_acl": "Отсутствует ACL.","admin_and_system.moderation_basis_required": "Укажи основание для удаления сообщений.","admin_and_system.must_be_iso_timestamp": "Требуется действительная метка времени ISO.",diff --git a/packages/errors/src/i18n/weblate/locales/sv-SE.json b/packages/errors/src/i18n/weblate/locales/sv-SE.jsonindex 921ab3e1d..4f27ea29a 100644--- a/packages/errors/src/i18n/weblate/locales/sv-SE.json+++ b/packages/errors/src/i18n/weblate/locales/sv-SE.json@@ -81,6 +81,7 @@"admin_and_system.invalid_timeout_value": "Ogiltigt timeout-värde.","admin_and_system.invalid_timestamp": "Ogiltig tidsstämpel.","admin_and_system.invalid_timezone_identifier": "Ogiltig tidszonsidentifierare.",+ "admin_and_system.message_shred_preview_changed": "De här meddelandena har ändrats efter förhandsvisningen. Förhandsvisa dem igen.","admin_and_system.missing_acl": "Åtkomstkontrollista saknas.","admin_and_system.moderation_basis_required": "Ange en grund för att radera meddelandena.","admin_and_system.must_be_iso_timestamp": "Måste vara en giltig ISO-tidsstämpel.",diff --git a/packages/errors/src/i18n/weblate/locales/th.json b/packages/errors/src/i18n/weblate/locales/th.jsonindex d2b6f22e5..623bf331d 100644--- a/packages/errors/src/i18n/weblate/locales/th.json+++ b/packages/errors/src/i18n/weblate/locales/th.json@@ -81,6 +81,7 @@"admin_and_system.invalid_timeout_value": "ค่าไทม์เอาต์ไม่ถูกต้อง","admin_and_system.invalid_timestamp": "การประทับเวลาไม่ถูกต้อง","admin_and_system.invalid_timezone_identifier": "ตัวระบุเขตเวลาไม่ถูกต้อง",+ "admin_and_system.message_shred_preview_changed": "ข้อความเหล่านี้เปลี่ยนไปหลังการแสดงตัวอย่าง โปรดแสดงตัวอย่างอีกครั้ง","admin_and_system.missing_acl": "ACL หายไป","admin_and_system.moderation_basis_required": "ระบุเหตุผลรองรับในการลบข้อความ","admin_and_system.must_be_iso_timestamp": "ต้องเป็นการประทับเวลา ISO ที่ถูกต้อง",diff --git a/packages/errors/src/i18n/weblate/locales/tr.json b/packages/errors/src/i18n/weblate/locales/tr.jsonindex e96719297..6c9030360 100644--- a/packages/errors/src/i18n/weblate/locales/tr.json+++ b/packages/errors/src/i18n/weblate/locales/tr.json@@ -81,6 +81,7 @@"admin_and_system.invalid_timeout_value": "Geçersiz zaman aşımı değeri.","admin_and_system.invalid_timestamp": "Geçersiz zaman damgası.","admin_and_system.invalid_timezone_identifier": "Geçersiz saat dilimi tanımlayıcısı.",+ "admin_and_system.message_shred_preview_changed": "Bu mesajlar önizlemeden sonra değişti. Önizlemeyi yeniden aç.","admin_and_system.missing_acl": "ACL eksik.","admin_and_system.moderation_basis_required": "Mesajları silmek için bir dayanak belirt.","admin_and_system.must_be_iso_timestamp": "Geçerli bir ISO zaman damgası olmalı.",diff --git a/packages/errors/src/i18n/weblate/locales/uk.json b/packages/errors/src/i18n/weblate/locales/uk.jsonindex 2c65ea655..c6651ba4e 100644--- a/packages/errors/src/i18n/weblate/locales/uk.json+++ b/packages/errors/src/i18n/weblate/locales/uk.json@@ -81,6 +81,7 @@"admin_and_system.invalid_timeout_value": "Недійсне значення тайм-ауту.","admin_and_system.invalid_timestamp": "Недійсна мітка часу.","admin_and_system.invalid_timezone_identifier": "Недійсний ідентифікатор часового поясу.",+ "admin_and_system.message_shred_preview_changed": "Ці повідомлення змінилися після попереднього перегляду. Перегляньте їх ще раз.","admin_and_system.missing_acl": "Немає ACL.","admin_and_system.moderation_basis_required": "Укажи підставу для видалення повідомлень.","admin_and_system.must_be_iso_timestamp": "Має бути дійсна мітка часу ISO.",diff --git a/packages/errors/src/i18n/weblate/locales/vi.json b/packages/errors/src/i18n/weblate/locales/vi.jsonindex 7f6de2f08..3fdbcff6e 100644--- a/packages/errors/src/i18n/weblate/locales/vi.json+++ b/packages/errors/src/i18n/weblate/locales/vi.json@@ -81,6 +81,7 @@"admin_and_system.invalid_timeout_value": "Giá trị thời gian tạm khóa không hợp lệ.","admin_and_system.invalid_timestamp": "Mốc thời gian không hợp lệ.","admin_and_system.invalid_timezone_identifier": "Mã định danh múi giờ không hợp lệ.",+ "admin_and_system.message_shred_preview_changed": "Các tin nhắn này đã thay đổi sau khi xem trước. Hãy xem trước lại.","admin_and_system.missing_acl": "Thiếu ACL.","admin_and_system.moderation_basis_required": "Hãy nêu căn cứ để xóa các tin nhắn.","admin_and_system.must_be_iso_timestamp": "Phải là mốc thời gian ISO hợp lệ.",diff --git a/packages/errors/src/i18n/weblate/locales/zh-CN.json b/packages/errors/src/i18n/weblate/locales/zh-CN.jsonindex 0ecba9d72..0240b7b5b 100644--- a/packages/errors/src/i18n/weblate/locales/zh-CN.json+++ b/packages/errors/src/i18n/weblate/locales/zh-CN.json@@ -81,6 +81,7 @@"admin_and_system.invalid_timeout_value": "超时值无效。","admin_and_system.invalid_timestamp": "时间戳无效。","admin_and_system.invalid_timezone_identifier": "时区标识符无效。",+ "admin_and_system.message_shred_preview_changed": "这些消息在预览后发生了变化。请重新预览。","admin_and_system.missing_acl": "缺少 ACL。","admin_and_system.moderation_basis_required": "请提供删除这些消息的依据。","admin_and_system.must_be_iso_timestamp": "必须是有效的 ISO 时间戳。",diff --git a/packages/errors/src/i18n/weblate/locales/zh-TW.json b/packages/errors/src/i18n/weblate/locales/zh-TW.jsonindex cb010100b..e9972969c 100644--- a/packages/errors/src/i18n/weblate/locales/zh-TW.json+++ b/packages/errors/src/i18n/weblate/locales/zh-TW.json@@ -81,6 +81,7 @@"admin_and_system.invalid_timeout_value": "逾時值無效。","admin_and_system.invalid_timestamp": "時間戳記無效。","admin_and_system.invalid_timezone_identifier": "時區識別碼無效。",+ "admin_and_system.message_shred_preview_changed": "這些訊息在預覽後已變更。請重新預覽。","admin_and_system.missing_acl": "缺少存取控制清單 (ACL)。","admin_and_system.moderation_basis_required": "請提供刪除這些訊息的依據。","admin_and_system.must_be_iso_timestamp": "必須為有效的 ISO 時間戳記。",diff --git a/packages/errors/src/i18n/weblate/messages.json b/packages/errors/src/i18n/weblate/messages.jsonindex 9b8b4a0c5..003e3db33 100644--- a/packages/errors/src/i18n/weblate/messages.json+++ b/packages/errors/src/i18n/weblate/messages.json@@ -81,6 +81,7 @@"admin_and_system.invalid_timeout_value": "Invalid timeout value.","admin_and_system.invalid_timestamp": "Invalid timestamp.","admin_and_system.invalid_timezone_identifier": "Invalid time zone identifier.",+ "admin_and_system.message_shred_preview_changed": "These messages changed after the preview. Preview them again.","admin_and_system.missing_acl": "Missing ACL.","admin_and_system.moderation_basis_required": "Give a basis to delete the messages.","admin_and_system.must_be_iso_timestamp": "Must be a valid ISO timestamp.",diff --git a/packages/schema/src/domains/admin/AdminMessageSchemas.ts b/packages/schema/src/domains/admin/AdminMessageSchemas.tsindex b8487ba09..bca6f6ab8 100644--- a/packages/schema/src/domains/admin/AdminMessageSchemas.ts+++ b/packages/schema/src/domains/admin/AdminMessageSchemas.ts@@ -76,10 +76,49 @@ export type AdminMessageDetailQuery = z.infer<typeof AdminMessageDetailQuery>;export const AdminUserMessageShredRequest = z.object({entries: z.array(MessageShredEntryType).min(1).max(1000),basis: ModerationBasis,+ preview_token: z+ .string()+ .regex(/^[0-9a-f]{64}$/)+ .optional()+ .describe(+ 'The preview_token of a preview of the same entries. When given, exactly the previewed messages are removed, and the request is refused if they changed since the preview',+ ),});export type AdminUserMessageShredRequest = z.infer<typeof AdminUserMessageShredRequest>;+export const AdminUserMessageShredPreviewRequest = z.object({+ entries: z.array(MessageShredEntryType).min(1).max(1000),+});++export type AdminUserMessageShredPreviewRequest = z.infer<typeof AdminUserMessageShredPreviewRequest>;++const MessageShredPreviewMessage = z.object({+ channel_id: SnowflakeStringType,+ message_id: SnowflakeStringType,+ timestamp: z.string().describe('When the message was sent, as an ISO 8601 timestamp'),+ content: z.string().describe('The start of the message text, up to 200 characters'),+ attachment_count: Int32Type,+});++const MessageShredPreviewSkipped = z.object({+ channel_id: SnowflakeStringType,+ message_id: SnowflakeStringType,+ reason: z+ .enum(['not_found', 'other_author', 'duplicate'])+ .describe('not_found when the message is not in that channel, other_author when someone else sent it'),+});++export const MessageShredPreviewResponse = z.object({+ requested: Int32Type,+ message_count: Int32Type.describe('How many messages a shred of these entries removes'),+ messages: z.array(MessageShredPreviewMessage).describe('Every message a shred of these entries removes'),+ skipped: z.array(MessageShredPreviewSkipped).describe('Entries a shred leaves alone, with the reason'),+ preview_token: z.string().describe('Pass this with the shred to remove exactly these messages'),+});++export type MessageShredPreviewResponse = z.infer<typeof MessageShredPreviewResponse>;+export const AdminUserMessageDeleteQuery = z.object({dry_run: z.string()