-
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
Task Share Destination Fixes #24019
Task Share Destination Fixes #24019
Changes from 15 commits
a262192
8c98c9a
b670ed5
c3591e5
603b305
3dd5301
157f56d
b778073
e938e74
1308dfd
a21355e
c703f7d
6bac6dc
de39deb
b9cc192
ce779cc
18daf91
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ import {View} from 'react-native'; | |
import PropTypes from 'prop-types'; | ||
import {withOnyx} from 'react-native-onyx'; | ||
import OptionsSelector from '../../components/OptionsSelector'; | ||
|
||
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. Another space added here 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. @thienlnam sorry for the inconvenience, removed some code after the adjustments with the new functions. I thought |
||
import * as OptionsListUtils from '../../libs/OptionsListUtils'; | ||
import ONYXKEYS from '../../ONYXKEYS'; | ||
import styles from '../../styles/styles'; | ||
|
@@ -45,35 +46,27 @@ function TaskShareDestinationSelectorModal(props) { | |
const [searchValue, setSearchValue] = useState(''); | ||
const [headerMessage, setHeaderMessage] = useState(''); | ||
const [filteredRecentReports, setFilteredRecentReports] = useState([]); | ||
const [filteredPersonalDetails, setFilteredPersonalDetails] = useState([]); | ||
const [filteredUserToInvite, setFilteredUserToInvite] = useState(null); | ||
|
||
const filteredReports = useMemo(() => { | ||
const reports = {}; | ||
_.keys(props.reports).forEach((reportKey) => { | ||
if (!ReportUtils.isAllowedToComment(props.reports[reportKey])) { | ||
if ( | ||
!ReportUtils.isAllowedToComment(props.reports[reportKey]) || | ||
ReportUtils.isArchivedRoom(props.reports[reportKey]) || | ||
ReportUtils.isExpensifyOnlyParticipantInReport(props.reports[reportKey]) | ||
) { | ||
return; | ||
} | ||
reports[reportKey] = props.reports[reportKey]; | ||
}); | ||
return reports; | ||
}, [props.reports]); | ||
const updateOptions = useCallback(() => { | ||
const {recentReports, personalDetails, userToInvite} = OptionsListUtils.getShareDestinationOptions( | ||
filteredReports, | ||
props.personalDetails, | ||
props.betas, | ||
searchValue.trim(), | ||
[], | ||
CONST.EXPENSIFY_EMAILS, | ||
true, | ||
); | ||
|
||
setHeaderMessage(OptionsListUtils.getHeaderMessage(recentReports?.length + personalDetails?.length !== 0, Boolean(userToInvite), searchValue)); | ||
|
||
setFilteredUserToInvite(userToInvite); | ||
const {recentReports} = OptionsListUtils.getShareDestinationOptions(filteredReports, props.personalDetails, props.betas, searchValue.trim(), [], CONST.EXPENSIFY_EMAILS, true); | ||
|
||
setHeaderMessage(OptionsListUtils.getHeaderMessage(recentReports?.length !== 0, false, searchValue)); | ||
|
||
setFilteredRecentReports(recentReports); | ||
setFilteredPersonalDetails(personalDetails); | ||
}, [props, searchValue, filteredReports]); | ||
|
||
useEffect(() => { | ||
|
@@ -101,23 +94,6 @@ function TaskShareDestinationSelectorModal(props) { | |
indexOffset += filteredRecentReports?.length; | ||
} | ||
|
||
if (filteredPersonalDetails?.length > 0) { | ||
sections.push({ | ||
data: filteredPersonalDetails, | ||
shouldShow: true, | ||
indexOffset, | ||
}); | ||
indexOffset += filteredRecentReports?.length; | ||
} | ||
|
||
if (filteredUserToInvite) { | ||
sections.push({ | ||
data: [filteredUserToInvite], | ||
shouldShow: true, | ||
indexOffset, | ||
}); | ||
} | ||
|
||
return sections; | ||
}; | ||
|
||
|
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.
Added space
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.
Removed, sorry