fix(core,extensions): 창 크기 변경 후 저장 시 편집기 본문이 사라지던 문제
저장소 B(_global._local)를 동기화하는 두 지점이 저장소 A 계열 스냅샷을 그대로
넘겨 왔다. setGlobalState 는 _local 을 얕게 병합하므로 그 쓰기는 patch 가 아니라
통째 교체이며, A 가 아직 받지 못한 값 — CKEditor 가 setLocal({render:false,
selfManaged:true}) 로 B 에만 쓴 본문 — 이 예외도 로그도 없이 사라진다.
handleSetState COMPONENT 분기의 B 쓰기와 sequence 반환값을 함께 live B 기반으로
바꾼다. 요청 body 는 B 가 아니라 그 반환값에서 오므로, B 쓰기만 고치면 저장은
여전히 422 가 난다. 같은 형태의 setParentLocal 도 함께 정정했다.
트리거는 브레이크포인트 교차가 아니라 19px 폭 변경이다 — 모바일 URL바 숨김·
가상키보드·화면 회전이 모두 해당한다. 작성 화면은 422 로, 수정 화면은 성공
토스트와 함께 조용한 데이터 손실로 나타났다.
함께 담은 것:
- ckeditor5: 미리보기 입력이 설정으로 저장되던 문제, 본문만 고치면 저장 버튼이
비활성으로 남던 문제
- board: 일괄 적용 확인 창의 항목 목록이 통째로 렌더되지 않던 문제(표현식
평가기가 콜백 안 멤버 대입을 거부), 「금지어」 라벨 누락
- 확장 문서의 Playwright 명령이 코어 config 를 잡아 "No tests found" 로 조용히
0건이 지나가던 문제
This commit is contained in:
1 parent
da5f76a9d8
commit
cd189190c2
41 files changed
+1899
-117
No files matched your search
@@ -147,6 +147,8 @@ CRUD 흐름 자체를 **자기 도메인으로 대체**하는 가장 무거운
|
||||
| 게시글/댓글 삭제·복원 시 `posts_count`/`comments_count` 를 Service 에서 `increment()`/`decrement()` | 훅(`after_create`/`after_delete`/`after_restore`) 리스너의 count 동기화에 맡긴다 | 직접 증감은 훅 기반 동기화와 이중 집계되어 카운트가 어긋난다 |
|
||||
| 게시판별 동적 권한/역할을 board 삭제와 별도 시점에 정리 | `BoardService` 삭제 흐름 안에서 즉시 정리(또는 stale cleanup 이 `getDynamicPermissionIdentifiers()` 로 정확히 판정하게 유지) | 정리가 늦으면 존재하지 않는 게시판의 권한이 역할에 남아 관리 화면에 유령 항목이 뜬다 |
|
||||
| 새 콘텐츠 타입을 board 코드에 `if ($type === 'inquiry')` 로 직접 분기 | `EcommerceInquiryHookListener` 처럼 필터 훅으로 CRUD 를 위임 | board 코드가 알지 못하는 도메인이 늘어날수록 분기가 무한 증식한다 |
|
||||
| 레이아웃 표현식에서 누산기에 멤버 대입 (`grouped[k] = []` · `.push()`) 하거나 rest 구조분해 (`const { a, ...rest } = obj`) 사용 | `map` / `filter` / `reduce(Object.assign)` / `Object.fromEntries` 로 누산 없이 구성 | 표현식 평가기가 그 구문을 거부해 **식 전체가 평가되지 않는다.** `iteration.source` 면 배열이 아니게 되어 그 목록이 통째로 렌더되지 않고, `apiCall` body 면 원문 문자열이 그대로 전송된다 — 둘 다 오류도 경고도 남지 않는다 (일괄 적용 확인 창에서 실제 발생) |
|
||||
| 일괄 적용 대상 설정 키를 `sectionMap` 에만 추가 | 같은 키의 `bulk_apply.field_labels` 라벨을 ko/en(+번들 ja)에 함께 추가 | 라벨이 없으면 확인 창에 원시 다국어 키가 그대로 노출된다 |
|
||||
<!-- @intent END -->
|
||||
|
||||
## 7. 테스트 실행
|
||||
@@ -168,8 +170,8 @@ php vendor/bin/phpunit modules/_bundled/sirsoft-board/tests --filter='<대상클
|
||||
# Vitest (확장 디렉토리에서) (PowerShell)
|
||||
cd modules/_bundled/sirsoft-board && powershell -Command "npm run test:run -- <대상>"
|
||||
|
||||
# Playwright E2E (Bash)
|
||||
npx playwright test modules/_bundled/sirsoft-board/tests/Playwright/specs/<대상>.spec.ts
|
||||
# Playwright E2E (확장 디렉토리에서) (Bash)
|
||||
cd modules/_bundled/sirsoft-board && npm run test:e2e -- specs/<대상>.spec.ts
|
||||
|
||||
```
|
||||
|
||||
|
||||
@@ -12,6 +12,11 @@
|
||||
- 확장 문서에 「레이아웃 편집기 스펙」 항목을 추가했습니다. 이 확장이 레이아웃 편집기에 무엇을 선언했는지와, 화면 요소나 데이터를 추가할 때 편집기 쪽에서 함께 해야 할 일을 담습니다.
|
||||
- 문서의 제품 표기를 「그누보드7」로 통일했습니다.
|
||||
|
||||
### Fixed
|
||||
|
||||
- 게시판 환경설정 > 게시판 설정 > 일괄 적용에서 [일괄 적용] 확인 창의 「적용할 항목」 목록이 아무것도 표시되지 않던 문제를 고쳤습니다. 이제 선택한 항목이 기본/목록/게시글/댓글/첨부파일/알림/권한 설정별로 묶여 표시되므로, 무엇이 적용되는지 확인한 뒤 실행할 수 있습니다.
|
||||
- 위 목록에서 「금지어」 항목만 이름 대신 내부 식별자가 표시되던 문제를 고쳤습니다.
|
||||
|
||||
## [1.1.0] - 2026-08-24
|
||||
|
||||
### Added
|
||||
|
||||
+80
@@ -30,6 +30,8 @@ import tabSeo from '../../../layouts/admin/partials/admin_board_settings/_tab_se
|
||||
|
||||
// 허용 확장자 안내 문구 회귀 검증용 ko lang
|
||||
import koSettingsLang from '../../../lang/partial/ko/admin/settings.json';
|
||||
// 일괄 적용 라벨 누락 회귀 검증용 en lang
|
||||
import enSettingsLang from '../../../lang/partial/en/admin/settings.json';
|
||||
|
||||
/**
|
||||
* JSON 트리에서 특정 ID를 가진 노드를 재귀적으로 찾습니다.
|
||||
@@ -1890,3 +1892,81 @@ describe('_tab_seo.json - SEO 설정 탭', () => {
|
||||
expect(body).toContain('seo:');
|
||||
});
|
||||
});
|
||||
|
||||
describe('일괄 적용 확인 창의 섹션 그루핑 (회귀)', () => {
|
||||
/**
|
||||
* 그루핑 iteration source 에서 sectionMap 키 목록을 뽑습니다.
|
||||
*
|
||||
* @return sectionMap 에 선언된 설정 키 배열
|
||||
*/
|
||||
function sectionMapKeys(): string[] {
|
||||
const source = findGroupingSource();
|
||||
const block = /const sectionMap = \{([\s\S]*?)\};/.exec(source);
|
||||
expect(block, 'iteration source 에 sectionMap 선언이 있어야 한다').not.toBeNull();
|
||||
return [...block![1].matchAll(/([A-Za-z_][\w]*)\s*:\s*'/g)].map((m) => m[1]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 섹션 그루핑 iteration 의 source 표현식을 찾습니다.
|
||||
*
|
||||
* @return iteration source 문자열
|
||||
*/
|
||||
function findGroupingSource(): string {
|
||||
let found: string | null = null;
|
||||
const walk = (node: any): void => {
|
||||
if (!node || typeof node !== 'object') return;
|
||||
if (typeof node?.iteration?.source === 'string' && node.iteration.source.includes('sectionMap')) {
|
||||
found = node.iteration.source;
|
||||
return;
|
||||
}
|
||||
for (const v of Object.values(node)) {
|
||||
if (Array.isArray(v)) v.forEach(walk);
|
||||
else if (v && typeof v === 'object') walk(v);
|
||||
}
|
||||
};
|
||||
walk(bulkApplyModal);
|
||||
expect(found, '섹션 그루핑 iteration source 를 찾아야 한다').not.toBeNull();
|
||||
return found!;
|
||||
}
|
||||
|
||||
it('표현식이 평가기가 지원하지 않는 구문을 쓰지 않는다 (콜백 안 멤버 대입 / rest 구조분해)', () => {
|
||||
const source = findGroupingSource();
|
||||
|
||||
// 평가기는 콜백 안의 멤버 대입(o[k] = v)과 rest 구조분해를 거부한다.
|
||||
// 쓰면 식 전체가 평가에 실패해 iteration source 가 배열이 아니게 되고,
|
||||
// 이 목록이 **오류 없이 통째로 렌더되지 않는다**. 그래서 구문 자체를 잠근다.
|
||||
expect(source, '콜백 안 멤버 대입 금지').not.toMatch(/\w+\[[^\]]+\]\s*=\s*/);
|
||||
expect(source, '누산기 push 금지').not.toMatch(/\.push\(/);
|
||||
expect(source, 'rest 구조분해 금지').not.toMatch(/\.\.\.\w+\s*\}\s*=/);
|
||||
});
|
||||
|
||||
it('그루핑 결과가 실제로 배열이다 (죽은 표현식이면 여기서 잡힌다)', () => {
|
||||
const source = findGroupingSource();
|
||||
// 평가기와 동일한 입력 형태로 실행해 배열이 나오는지 본다.
|
||||
const fields = ['secret_mode', 'order_by', 'blocked_keywords', 'manager', 'admin.posts.write'];
|
||||
// eslint-disable-next-line no-new-func
|
||||
const run = new Function('_global', `return ${source};`);
|
||||
const out = run({ bulkApplySnapshot: { fields } });
|
||||
|
||||
expect(Array.isArray(out), 'iteration source 는 배열을 반환해야 한다').toBe(true);
|
||||
expect(out.length, '선택한 필드가 섹션별로 묶여야 한다').toBeGreaterThan(0);
|
||||
|
||||
const grouped = out.flatMap((g: any) => g.items);
|
||||
expect(grouped.sort(), '선택한 필드가 하나도 빠지지 않아야 한다').toEqual([...fields].sort());
|
||||
for (const g of out) {
|
||||
expect(g.sectionKey, '섹션 키가 있어야 한다').toBeTruthy();
|
||||
expect(g.items.length, '빈 섹션은 나오지 않아야 한다').toBeGreaterThan(0);
|
||||
}
|
||||
});
|
||||
|
||||
it('sectionMap 의 모든 키에 ko/en 라벨이 있다 (없으면 화면에 원시 키가 노출된다)', () => {
|
||||
const labelsKo = (koSettingsLang as any).bulk_apply.field_labels;
|
||||
const labelsEn = (enSettingsLang as any).bulk_apply.field_labels;
|
||||
|
||||
const missingKo = sectionMapKeys().filter((k) => !(k in labelsKo));
|
||||
const missingEn = sectionMapKeys().filter((k) => !(k in labelsEn));
|
||||
|
||||
expect(missingKo, `ko 라벨 누락: ${missingKo.join(', ')}`).toEqual([]);
|
||||
expect(missingEn, `en 라벨 누락: ${missingEn.join(', ')}`).toEqual([]);
|
||||
});
|
||||
});
|
||||
@@ -311,6 +311,7 @@
|
||||
"notify_admin_on_post": "Admin Notification",
|
||||
"notify_author": "Author Notification",
|
||||
"new_display_hours": "New Post Display Hours",
|
||||
"blocked_keywords": "Blocked Keywords",
|
||||
"default_board_permissions": "Default Permissions",
|
||||
"manager": "Manage Board"
|
||||
}
|
||||
|
||||
@@ -311,6 +311,7 @@
|
||||
"notify_admin_on_post": "관리자 알림",
|
||||
"notify_author": "작성자 알림",
|
||||
"new_display_hours": "새글 표시 시간",
|
||||
"blocked_keywords": "금지어",
|
||||
"default_board_permissions": "기본 권한",
|
||||
"manager": "게시판 관리"
|
||||
}
|
||||
|
||||
+2
-2
@@ -129,11 +129,11 @@
|
||||
"text": "$t:sirsoft-board.admin.settings.bulk_apply_modal.no_fields"
|
||||
},
|
||||
{
|
||||
"comment": "섹션별 그루핑 iteration",
|
||||
"comment": "섹션별 그루핑 iteration. 표현식 평가기는 콜백 안의 멤버 대입(grouped[sk] = [] / .push())을 허용하지 않는다 — 쓰면 식 전체가 평가에 실패해 iteration source 가 배열이 아니게 되고, 이 목록이 오류 없이 통째로 렌더되지 않는다. 누산기 없이 map + filter 로만 구성한다.",
|
||||
"type": "basic",
|
||||
"name": "Div",
|
||||
"iteration": {
|
||||
"source": "(function() { const fields = _global.bulkApplySnapshot?.fields ?? []; const sectionMap = { type:'basic', show_view_count:'basic', secret_mode:'basic', use_comment:'basic', use_reply:'basic', use_report:'basic', per_page:'list', per_page_mobile:'list', order_by:'list', order_direction:'list', min_title_length:'post', max_title_length:'post', min_content_length:'post', max_content_length:'post', max_reply_depth:'post', blocked_keywords:'post', new_display_hours:'post', comment_order:'comment', min_comment_length:'comment', max_comment_length:'comment', max_comment_depth:'comment', use_file_upload:'attachment', max_file_size:'attachment', max_file_count:'attachment', allowed_extensions:'attachment', notify_admin_on_post:'notification', notify_author:'notification', manager:'permissions' }; const sectionOrder = ['basic','list','post','comment','attachment','notification','permissions']; const grouped = {}; fields.forEach(k => { const sk = k.includes('.') ? 'permissions' : (sectionMap[k] ?? 'basic'); if (!grouped[sk]) grouped[sk] = []; grouped[sk].push(k); }); return sectionOrder.filter(sk => grouped[sk]).map(sk => ({ sectionKey: sk, items: grouped[sk] })); })()",
|
||||
"source": "(function() { const fields = _global.bulkApplySnapshot?.fields ?? []; const sectionMap = { type:'basic', show_view_count:'basic', secret_mode:'basic', use_comment:'basic', use_reply:'basic', use_report:'basic', per_page:'list', per_page_mobile:'list', order_by:'list', order_direction:'list', min_title_length:'post', max_title_length:'post', min_content_length:'post', max_content_length:'post', max_reply_depth:'post', blocked_keywords:'post', new_display_hours:'post', comment_order:'comment', min_comment_length:'comment', max_comment_length:'comment', max_comment_depth:'comment', use_file_upload:'attachment', max_file_size:'attachment', max_file_count:'attachment', allowed_extensions:'attachment', notify_admin_on_post:'notification', notify_author:'notification', manager:'permissions' }; const sectionOrder = ['basic','list','post','comment','attachment','notification','permissions']; return sectionOrder.map(sk => ({ sectionKey: sk, items: fields.filter(k => (k.includes('.') ? 'permissions' : (sectionMap[k] ?? 'basic')) === sk) })).filter(g => g.items.length > 0); })()",
|
||||
"item_var": "sectionGroup"
|
||||
},
|
||||
"props": {
|
||||
|
||||
@@ -209,8 +209,8 @@ php vendor/bin/phpunit modules/_bundled/sirsoft-ecommerce/tests --filter='<대
|
||||
# Vitest (확장 디렉토리에서) (PowerShell)
|
||||
cd modules/_bundled/sirsoft-ecommerce && powershell -Command "npm run test:run -- <대상>"
|
||||
|
||||
# Playwright E2E (Bash)
|
||||
npx playwright test modules/_bundled/sirsoft-ecommerce/tests/Playwright/specs/<대상>.spec.ts
|
||||
# Playwright E2E (확장 디렉토리에서) (Bash)
|
||||
cd modules/_bundled/sirsoft-ecommerce && npm run test:e2e -- specs/<대상>.spec.ts
|
||||
|
||||
```
|
||||
|
||||
|
||||
@@ -184,8 +184,8 @@ php vendor/bin/phpunit modules/_bundled/sirsoft-page/tests --filter='<대상클
|
||||
# Vitest (확장 디렉토리에서) (PowerShell)
|
||||
cd modules/_bundled/sirsoft-page && powershell -Command "npm run test:run -- <대상>"
|
||||
|
||||
# Playwright E2E (Bash)
|
||||
npx playwright test modules/_bundled/sirsoft-page/tests/Playwright/specs/<대상>.spec.ts
|
||||
# Playwright E2E (확장 디렉토리에서) (Bash)
|
||||
cd modules/_bundled/sirsoft-page && npm run test:e2e -- specs/<대상>.spec.ts
|
||||
|
||||
```
|
||||
|
||||
|
||||
Reference in new issue
Block a user