Skip to content
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 pressing the task report (with assignee) header opens the assignee profile page #30452

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/LHNOptionsList/OptionRowLHN.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ function OptionRowLHN(props) {
const statusClearAfterDate = lodashGet(optionItem, 'status.clearAfter', '');
const formattedDate = DateUtils.getStatusUntilDate(statusClearAfterDate);
const statusContent = formattedDate ? `${statusText} (${formattedDate})` : statusText;
const isStatusVisible = Permissions.canUseCustomStatus(props.betas) && !!emojiCode && ReportUtils.isOneOnOneChat(optionItem);
const isStatusVisible = Permissions.canUseCustomStatus(props.betas) && !!emojiCode && ReportUtils.isOneOnOneChat(ReportUtils.getReport(optionItem.reportID));

const isGroupChat =
optionItem.type === CONST.REPORT.TYPE.CHAT && _.isEmpty(optionItem.chatType) && !optionItem.isThread && lodashGet(optionItem, 'displayNamesWithTooltips.length', 0) > 2;
Expand Down
46 changes: 22 additions & 24 deletions src/libs/ReportUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,27 @@ function isMoneyRequestReport(reportOrID) {
return isIOUReport(report) || isExpenseReport(report);
}

/**
* Should return true only for personal 1:1 report
*
* @param {Object} report (chatReport or iouReport)
* @returns {boolean}
*/
function isOneOnOneChat(report) {
const participantAccountIDs = lodashGet(report, 'participantAccountIDs', []);
return (
!isThread(report) &&
!isChatRoom(report) &&
!isExpenseRequest(report) &&
!isMoneyRequestReport(report) &&
!isPolicyExpenseChat(report) &&
!isTaskReport(report) &&
isDM(report) &&
!isIOUReport(report) &&
participantAccountIDs.length === 1
);
}

/**
* Get the report given a reportID
*
Expand Down Expand Up @@ -2135,7 +2156,7 @@ function getParentNavigationSubtitle(report) {
function navigateToDetailsPage(report) {
const participantAccountIDs = lodashGet(report, 'participantAccountIDs', []);

if (isDM(report) && participantAccountIDs.length === 1) {
if (isOneOnOneChat(report)) {
Navigation.navigate(ROUTES.PROFILE.getRoute(participantAccountIDs[0]));
return;
}
Expand Down Expand Up @@ -3152,29 +3173,6 @@ function isIOUOwnedByCurrentUser(report, allReportsDict = null) {
return reportToLook.ownerAccountID === currentUserAccountID;
}

/**
* Should return true only for personal 1:1 report
*
* @param {Object} report (chatReport or iouReport)
* @returns {boolean}
*/
function isOneOnOneChat(report) {
const isChatRoomValue = lodashGet(report, 'isChatRoom', false);
const participantsListValue = lodashGet(report, 'participantsList', []);
return (
!isThread(report) &&
!isChatRoom(report) &&
!isChatRoomValue &&
!isExpenseRequest(report) &&
!isMoneyRequestReport(report) &&
!isPolicyExpenseChat(report) &&
!isTaskReport(report) &&
isDM(report) &&
!isIOUReport(report) &&
participantsListValue.length === 1
);
}

/**
* Assuming the passed in report is a default room, lets us know whether we can see it or not, based on permissions and
* the various subsets of users we've allowed to use default rooms.
Expand Down
Loading