decaporg / decaporg/decap-cms

required ignored in fields inside a list on i18n translations

オープン
#5,653 コメント 0 件 リアクション 4 件 担当者 0 名 GitHub で見る
area: extensions/widgets/list area: i18n type: bug
主要言語
JavaScript
スター
19.4k
フォーク
3.1k
平均マージ
1日 14時間
マージ済み PR(30日)
9

説明

**Describe the bug**
`required` on fields inside a `list` field is ignored for i18n transitions.
`required` is only respected in the first translation but is not respected for other translations.

**To Reproduce**
1) Clone the repo
```
git clone https://github.com/surjithctly/neat-starter.git
```

2) Use the config given below

3) Start local netlify proxy
```
npx netlify-cms-proxy-server
```

4) Start local dev server
```
npm run start
```

5) Go to http://localhost:8080/admin

6) Click on `media channels`
7) Click on `Add distribution` on **Writing in ES**

8) Publish while `channel` is empty

**Expected behavior**
Expected to see error message `Channel field is required`

**Actual Behaviour**
Was able to save with empty field

**Screenshots**
![image](https://user-images.githubusercontent.com/20378877/127322738-dde1c94b-0f86-4059-9375-076b2ae7dc96.png)

**Applicable Versions:**

- netlify-cms-app 2.15.30
- netlify-cms-core 2.46.0
- index.js:27 netlify-cms 2.10.150
- Browser version Chrome 92 on MacOS Big Sur `11.4 `

- Node.JS version: `v16.1.0`

**CMS configuration**
```
i18n:
structure: single_file
locales: [en, es, ar, hi, zh]
default_locale: en

backend:
# Use netlify identity as backend
name: git-gateway
branch: master
### enable below lines for github integration ###
# name: github
# repo: surjithctly/neat-starter
media_folder: "src/static/img"
public_folder: "/static/img"

# Please run "npx netlify-cms-proxy-server" for local backend
local_backend: true
# publish_mode: editorial_workflow
collections:
[
{
label: "Repeated Content Blocks",
name: "generalAreas",
i18n: true,
files:
[
{
name: "media",
label: "Media Channels",
file: "src/_data/channels.json",
i18n: true,
fields:
[
{
label: "Distribution",
name: "distribution",
widget: "list",
required: true,
allow_add: true,
i18n: true,
fields:
[
{
name: "channel",
label: "Channel",
widget: "string",
i18n: true,
required: true,
},
],
},
],
},

],
},
]

```

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

提供された CMS 設定で src/_data/channels.json、npx netlify-cms-proxy-server、npm run start を使用して問題を再現し、その後 /admin を開いて ES 翻訳の空のチャンネルをテストします。すべての翻訳でリストフィールドの必須フィールド検証を追跡します。完了の条件は、ES およびその他のデフォルト以外のロケールで “Channel field is required” によって公開がブロックされることです。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript
領域
frontend, internationalization
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。