feat(topics): restore topic taxonomy workflow
This commit is contained in:
1 parent
f3dd1ec3b1
commit
a254cbd3e9
59 files changed
+771
-192
No files matched your search
@@ -1,20 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* 「前台投稿」后台设置页契约(对齐参考主题 1:1,不含专题):
|
||||
* 1) PHP schema(SchemaPostList.php submit section)字段键、顺序、默认值与
|
||||
* JS schema(assets/admin/src/schema/sections/post-list/submit.js)一致;
|
||||
* 2) 参考主题字段全集存在:post_article_s / post_article_btn_txte / post_article_cat /
|
||||
* post_article_custom_filter_s / post_article_tag / post_article_user /
|
||||
* post_article_title_strlen_limit / post_article_pay_free_s /
|
||||
* post_article_pay_price_limit / post_article_pay_vip_price_s /
|
||||
* post_article_pay_vip_1_discount / post_article_pay_vip_2_discount /
|
||||
* post_t_placeholder / post_c_placeholder;
|
||||
* 3) 专题(topics)相关字段不存在;
|
||||
* 4) 旧 Jio 私有字段(front_submit_*、post_article_title_strlen_limit_min/max、
|
||||
* post_article_pay_price_min/max)已彻底移除,无双路兼容;
|
||||
* 5) 运行时(PostDisplay::get_submit_settings)只读取新键。
|
||||
*/
|
||||
/** 前台投稿设置的字段顺序、默认值与运行时契约。 */
|
||||
|
||||
const assert = require('node:assert/strict');
|
||||
const fs = require('node:fs');
|
||||
@@ -30,6 +16,8 @@ const REFERENCE_KEYS = [
|
||||
'post_article_s',
|
||||
'post_article_btn_txte',
|
||||
'post_article_cat',
|
||||
'post_article_topics_s',
|
||||
'post_article_topics',
|
||||
'post_article_custom_filter_s',
|
||||
'post_article_tag',
|
||||
'post_article_user',
|
||||
@@ -114,9 +102,9 @@ test('PHP submit section 字段键与参考主题一致且顺序相同', () => {
|
||||
assert.deepEqual(found, PHP_FIELD_ORDER);
|
||||
});
|
||||
|
||||
test('PHP submit section 不含专题字段', () => {
|
||||
assert.doesNotMatch(submitPhp, /post_article_topics/);
|
||||
assert.doesNotMatch(submitPhp, /'topics'/);
|
||||
test('PHP submit section 包含专题开关与可选专题', () => {
|
||||
assert.match(submitPhp, /'post_article_topics_s',\s*'label'\s*=>\s*'允许选择专题',\s*'type'\s*=>\s*'switch',\s*'default'\s*=>\s*false/);
|
||||
assert.match(submitPhp, /'post_article_topics',\s*'label'\s*=>\s*'投稿允许选择的专题',\s*'type'\s*=>\s*'taxonomy_select',\s*'taxonomy'\s*=>\s*'topics'/);
|
||||
});
|
||||
|
||||
test('PHP submit section 默认值对齐参考主题', () => {
|
||||
@@ -154,7 +142,7 @@ test('JS schema 与 PHP 字段键一致(ui_only content 行除外)', () => {
|
||||
for (const legacy of LEGACY_KEYS) {
|
||||
assert.ok(!keys.includes(legacy), `JS schema 残留旧字段: ${legacy}`);
|
||||
}
|
||||
// 两个 ui_only 提示行承载参考主题 desc 中的【去设置】链接。
|
||||
// 两个 ui_only 提示行承载【去设置】链接。
|
||||
assert.match(js, /permissions\/capabilities/);
|
||||
assert.match(js, /post-list\/filter/);
|
||||
assert.match(js, /ui_only:\s*true/);
|
||||
|
||||
Reference in new issue
Block a user