From ee783585aef8eba4774e539858848d779bf0b4f3 Mon Sep 17 00:00:00 2001 From: "saito.k" Date: Tue, 8 Aug 2023 09:43:04 +0000 Subject: [PATCH] =?UTF-8?q?Merged=20PR=20316:=20dev=E5=8B=95=E4=BD=9C?= =?UTF-8?q?=E7=A2=BA=E8=AA=8D=E3=81=A7=E7=99=BA=E8=A6=8B=E3=81=97=E3=81=9F?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E5=AF=BE=E8=B1=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 概要 [Task2368: dev動作確認で発見した修正対象](https://paruru.nds-tyo.co.jp:8443/tfs/ReciproCollection/fa4924a4-d079-4fab-9fb5-a9a11eb205f0/_workitems/edit/2368) - デザイン周り - ラジオボタン・チェックボックスのラべルを押下しても状態を変更できるように修正 - 機能 - もともとパスワードがあったとき、フォーカスを当てて伏字がなくなった状態になった場合は、値をチェックするように修正 - Encryption:ON→パスワード入力→Encryption:OFFにしてユーザー追加したとき、入力していたパスワードがServerに送られてしまっていたので、Encryption:OFFにしたらパスワードをundefinedにするように修正 - ポップアップが閉じたときにユーザー一覧画面を更新する挙動になっていたため、閉じたときは何もしないように修正 ## レビューポイント - 修正箇所・修正対応に問題はないか - 確認しておいた方が良い挙動はあるか ## UIの変更 -https://ndstokyo.sharepoint.com/:f:/r/sites/Piranha/Shared%20Documents/General/OMDS/%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%BC%E3%83%B3%E3%82%B7%E3%83%A7%E3%83%83%E3%83%88/Task2368?csf=1&web=1&e=pyfaXd ## 動作確認状況 - ローカルで確認 ## 補足 - 相談、参考資料などがあれば --- .../src/features/user/operations.ts | 13 ++++++----- .../src/features/user/selectors.ts | 7 ++---- .../src/features/user/userSlice.ts | 9 ++++++-- .../src/pages/UserListPage/index.tsx | 2 -- .../src/pages/UserListPage/popup.tsx | 23 +++++++++++-------- .../src/pages/UserListPage/updatePopup.tsx | 23 +++++++++++-------- 6 files changed, 44 insertions(+), 33 deletions(-) diff --git a/dictation_client/src/features/user/operations.ts b/dictation_client/src/features/user/operations.ts index 8c35726..d975075 100644 --- a/dictation_client/src/features/user/operations.ts +++ b/dictation_client/src/features/user/operations.ts @@ -59,16 +59,17 @@ export const addUserAsync = createAsyncThunk< const config = new Configuration(configuration); const usersApi = new UsersApi(config); const { addUser } = state.user.apps; + const newUser = { ...addUser }; // roleがAUTHOR以外の場合、不要なプロパティをundefinedにする - if (addUser.role !== USER_ROLES.AUTHOR) { - addUser.authorId = undefined; - addUser.encryption = undefined; - addUser.prompt = undefined; - addUser.encryptionPassword = undefined; + if (newUser.role !== USER_ROLES.AUTHOR) { + newUser.authorId = undefined; + newUser.encryption = undefined; + newUser.prompt = undefined; + newUser.encryptionPassword = undefined; } try { - await usersApi.signup(addUser, { + await usersApi.signup(newUser, { headers: { authorization: `Bearer ${accessToken}` }, }); thunkApi.dispatch( diff --git a/dictation_client/src/features/user/selectors.ts b/dictation_client/src/features/user/selectors.ts index 854e02b..5cb63be 100644 --- a/dictation_client/src/features/user/selectors.ts +++ b/dictation_client/src/features/user/selectors.ts @@ -63,11 +63,8 @@ export const selectUpdateValidationErrors = (state: RootState) => { ); if (passwordError) { - // 最初にEncryptionがfasleで、Encryptionがtrueに変更された場合、EncryptionPasswordが必須 - if (!initEncryption) { - hasErrorIncorrectEncryptionPassword = true; - // Encryptionがある状態で変更がある場合、EncryptionPasswordが空でもエラーにしない - } else if (!encryptionPassword || encryptionPassword === "") { + // 最初にEncryptionがtrueで、EncryptionPassword変更されていない場合はエラーとしない + if (initEncryption && encryptionPassword === undefined) { hasErrorIncorrectEncryptionPassword = false; } else { hasErrorIncorrectEncryptionPassword = true; diff --git a/dictation_client/src/features/user/userSlice.ts b/dictation_client/src/features/user/userSlice.ts index 46066d7..528ca61 100644 --- a/dictation_client/src/features/user/userSlice.ts +++ b/dictation_client/src/features/user/userSlice.ts @@ -90,6 +90,9 @@ export const userSlice = createSlice({ ) => { const { encryption } = action.payload; state.apps.addUser.encryption = encryption; + if (!encryption) { + state.apps.addUser.encryptionPassword = undefined; + } }, changePrompt: (state, action: PayloadAction<{ prompt: boolean }>) => { const { prompt } = action.payload; @@ -170,14 +173,16 @@ export const userSlice = createSlice({ if (initEncryption && encryption && !password) { state.apps.hasPasswordMask = true; } + if (!encryption) { + state.apps.updateUser.encryptionPassword = undefined; + } }, changeUpdateEncryptionPassword: ( state, action: PayloadAction<{ encryptionPassword: string }> ) => { const { encryptionPassword } = action.payload; - state.apps.updateUser.encryptionPassword = - encryptionPassword === "" ? undefined : encryptionPassword; + state.apps.updateUser.encryptionPassword = encryptionPassword; }, changeUpdatePrompt: (state, action: PayloadAction<{ prompt: boolean }>) => { const { prompt } = action.payload; diff --git a/dictation_client/src/pages/UserListPage/index.tsx b/dictation_client/src/pages/UserListPage/index.tsx index 787f902..0f4ac6b 100644 --- a/dictation_client/src/pages/UserListPage/index.tsx +++ b/dictation_client/src/pages/UserListPage/index.tsx @@ -59,14 +59,12 @@ const UserListPage: React.FC = (): JSX.Element => { isOpen={isUpdatePopupOpen} onClose={() => { setIsUpdatePopupOpen(false); - dispatch(listUsersAsync()); }} /> { setIsPopupOpen(false); - dispatch(listUsersAsync()); }} />
diff --git a/dictation_client/src/pages/UserListPage/popup.tsx b/dictation_client/src/pages/UserListPage/popup.tsx index 9e0328f..35c8f0f 100644 --- a/dictation_client/src/pages/UserListPage/popup.tsx +++ b/dictation_client/src/pages/UserListPage/popup.tsx @@ -20,6 +20,7 @@ import { changePrompt, changeEncryption, changeEncryptionPassword, + listUsersAsync, } from "features/user"; import { USER_ROLES } from "components/auth/constants"; import close from "../../assets/images/close.svg"; @@ -75,6 +76,7 @@ export const UserAddPopup: React.FC = (props) => { if (meta.requestStatus === "fulfilled") { closePopup(); + dispatch(listUsersAsync()); } }, [ hasErrorEmptyName, @@ -146,9 +148,9 @@ export const UserAddPopup: React.FC = (props) => {
{t(getTranslationID("userListPage.label.role"))}
-
{t(getTranslationID("userListPage.label.setting"))}

-

-

-

{t(getTranslationID("userListPage.label.role"))}
-
{t(getTranslationID("userListPage.label.setting"))}

-

-

-