fix(report): give preset reasons a stable non-empty slug for CJK labels

ban_settings() derived each reason slug via sanitize_key(label), which
strips CJK text to an empty string; the frontend filter then discarded
every reason (including the schema defaults) and fell back to the
hard-coded list. Derive the slug from an ASCII key when possible and
from a stable md5 short hash of the label otherwise, and relax the
frontend filter to the label only. Adds a WP-stub harness that verifies
the defaults path end to end (tests/dev/verify-ban-settings-defaults.php).
This commit is contained in:
2026-09-20 14:48:28 +08:00
parent 67547fdf23
commit 3d4179a756
4 changed files with 88 additions and 4 deletions
+1 -1
View File
@@ -41,7 +41,7 @@
name: String((cat && (cat.name || cat.label || cat.t)) || ''),
};
})
.filter(function (cat) { return cat.slug !== '' && cat.name !== ''; });
.filter(function (cat) { return cat.name !== ''; });
if (items.length) return items;
}
return [