-
Notifications
You must be signed in to change notification settings - Fork 220
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Multi group grant page becomes public when one of groups deleted #8518
fix: Multi group grant page becomes public when one of groups deleted #8518
Conversation
}); | ||
|
||
/* | ||
* Update UserGroup | ||
*/ | ||
test('Updated values should be reflected. (name, description, parent)', async() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ここら辺の既存部分への変更は、メソッド単位でテストを describe で囲んだだけです。
const userGroupRelation12AfterRemove = await UserGroupRelation.findOne({ relatedGroup: userGroup12._id, relatedUser: userId1 }); | ||
await expect(userGroupRelation11AfterRemove).toBeNull(); | ||
await expect(userGroupRelation12AfterRemove).toBeNull(); | ||
describe('removeCompletelyByRootGroupId', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ここから下が新規テストになります。
@@ -1531,6 +1531,7 @@ describe('Page', () => { | |||
// userB group remains, although options does not include it | |||
{ item: userGroupIdPModelB, type: GroupType.userGroup }, | |||
])); | |||
expect(normalizeGrantedGroups(page.grantedGroups).length).toBe(3); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
過去テスト補強:
expect.arrayContaining は array の中身に要素群がいるかを確認するだけで、完全一致かどうかは確認していなかったため、length の assertion を追加。
@@ -196,14 +195,19 @@ export const UserGroupDeleteModal: FC<Props> = (props: Props) => { | |||
</ModalBody> | |||
<ModalFooter> | |||
<form className="d-flex justify-content-between w-100" onSubmit={handleSubmit}> | |||
<div className="d-flex mb-0"> | |||
<div className="d-flex mb-0 me-3 "> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
なんかおかしなスペースがある
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
修正しました。
{renderPageActionSelector()} | ||
{renderGroupSelector()} | ||
</div> | ||
<button type="submit" value="" className="btn btn-sm btn-danger text-nowrap" disabled={!validateForm()}> | ||
<span className="material-symbols-outlined">delete_forever</span> {t('Delete')} | ||
</button> | ||
</form> | ||
{actionName === 'public' && ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ついでに public, delete, transfer を const (enum 的な) に変えてください
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PageActionOnGroupDelete を定義しました。
|
||
switch (action) { | ||
case 'public': | ||
await Page.publicizePages(pages); | ||
case 'public': { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const (enum) を参照して挙動を変える
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PageActionOnGroupDelete を定義しました。
}, | ||
}; | ||
}); | ||
await Page.bulkWrite(queries); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Page.publicizePages の引数を拡張して groupsToDeleteIds を渡して、その中で updateOne クエリを変える方がよさそうだなあ
そうすると名前も publicize じゃない方がいいのかもしれない
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removeGroupsToDeleteFromPages として実装し直しました。
…e-becomes-public-when-one-of-groups-deleted
reg-suit detected visual differences. Check this report, and review them. 🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴 What do the circles mean?The number of circles represent the number of changed images.🔴 : Changed items, ⚪ : New items, ⚫ : Deleted items, and 🔵 Passed items How can I change the check status?If reviewers approve this PR, the reg context status will be green automatically. |
task
https://redmine.weseek.co.jp/issues/141311
管理画面イメージ
「公開可能なページを公開する」選択時のみ補足は表示される。
![image](https://private-user-images.githubusercontent.com/32846231/307573240-77f15f45-a76a-4934-b4f9-d7247b2af3d9.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzMjE3ODcsIm5iZiI6MTczOTMyMTQ4NywicGF0aCI6Ii8zMjg0NjIzMS8zMDc1NzMyNDAtNzdmMTVmNDUtYTc2YS00OTM0LWI0ZjktZDcyNDdiMmFmM2Q5LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEyVDAwNTEyN1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWM3OTYxYjlmOGY4MzcxNTJmODJjYjNkMjU5M2NkM2FhZTBlOGNkMGRkYzBlYmRiOGUwYTA5ODU3YWVhOTg3N2MmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.2ffPLyfk7dvhH82McikwxX7LpOyEEOZkTKwuMRtxtCA)