-
Notifications
You must be signed in to change notification settings - Fork 3k
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: Disable admin checkbox and checkbox all #21375
Merged
Merged
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
9862d02
disable admin checkbox
dukenv0307 f0079d1
add accessbilityLabel prop
dukenv0307 293b85b
update comment
dukenv0307 2acdc32
fix lint
dukenv0307 91a7810
Update src/pages/workspace/WorkspaceMembersPage.js
dukenv0307 ac1e09d
Update src/pages/workspace/WorkspaceMembersPage.js
dukenv0307 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -292,6 +292,7 @@ function WorkspaceMembersPage(props) { | |
*/ | ||
const renderItem = useCallback( | ||
({item}) => { | ||
const disabled = props.session.email === item.login || item.role === 'admin'; | ||
const hasError = !_.isEmpty(item.errors) || errors[item.accountID]; | ||
const isChecked = _.contains(selectedEmployees, Number(item.accountID)); | ||
return ( | ||
|
@@ -302,23 +303,26 @@ function WorkspaceMembersPage(props) { | |
> | ||
<PressableWithFeedback | ||
style={[styles.peopleRow, (_.isEmpty(item.errors) || errors[item.accountID]) && styles.peopleRowBorderBottom, hasError && styles.borderColorDanger]} | ||
disabled={disabled} | ||
onPress={() => toggleUser(item.accountID, item.pendingAction)} | ||
accessibilityRole="checkbox" | ||
accessibilityState={{ | ||
checked: isChecked, | ||
}} | ||
accessibilityLabel={props.formatPhoneNumber(item.displayName)} | ||
// disable hover dimming | ||
// Disable hover dimming | ||
dukenv0307 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
hoverDimmingValue={1} | ||
pressDimmingValue={0.7} | ||
> | ||
<Checkbox | ||
disabled={disabled} | ||
isChecked={isChecked} | ||
onPress={() => toggleUser(item.accountID, item.pendingAction)} | ||
/> | ||
<View style={styles.flex1}> | ||
<OptionRow | ||
boldStyle | ||
isDisabled={disabled} | ||
option={{ | ||
text: props.formatPhoneNumber(item.displayName), | ||
alternateText: props.formatPhoneNumber(item.login), | ||
|
@@ -448,10 +452,24 @@ function WorkspaceMembersPage(props) { | |
{data.length > 0 ? ( | ||
<View style={[styles.w100, styles.mt4, styles.flex1]}> | ||
<View style={[styles.peopleRow, styles.ph5, styles.pb3]}> | ||
<Checkbox | ||
isChecked={!_.isEmpty(removableMembers) && _.every(_.keys(removableMembers), (accountID) => _.contains(selectedEmployees, Number(accountID)))} | ||
<PressableWithFeedback | ||
disabled={_.isEmpty(removableMembers)} | ||
onPress={() => toggleAllUsers(removableMembers)} | ||
/> | ||
accessibilityRole="checkbox" | ||
accessibilityState={{ | ||
checked: !_.isEmpty(removableMembers) && _.every(_.keys(removableMembers), (accountID) => _.contains(selectedEmployees, Number(accountID))), | ||
}} | ||
accessibilityLabel={props.translate('workspace.people.selectAll')} | ||
// Disable hover dimming | ||
dukenv0307 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
hoverDimmingValue={1} | ||
pressDimmingValue={0.7} | ||
> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is a console error. You need to add There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks. Just updated |
||
<Checkbox | ||
disabled={_.isEmpty(removableMembers)} | ||
isChecked={!_.isEmpty(removableMembers) && _.every(_.keys(removableMembers), (accountID) => _.contains(selectedEmployees, Number(accountID)))} | ||
onPress={() => toggleAllUsers(removableMembers)} | ||
/> | ||
</PressableWithFeedback> | ||
<View style={[styles.flex1]}> | ||
<Text style={[styles.textStrong, styles.ph5]}>{props.translate('workspace.people.selectAll')}</Text> | ||
</View> | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Hello! I believe that bug #23890 could have been addressed within this PR. In offline mode, it's important to consider disabling users who have pending delete actions.