Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import useCurrentReportID from '@hooks/useCurrentReportID';
import useStyleUtils from '@hooks/useStyleUtils';
import useThemeStyles from '@hooks/useThemeStyles';
import {getReport} from '@libs/ReportUtils';
import * as ReportUtils from '@libs/ReportUtils';
import Navigation from '@navigation/Navigation';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
Expand All @@ -37,7 +36,7 @@ const getMentionDetails = (htmlAttributeReportID: string, currentReport: OnyxEnt
if (!isEmpty(htmlAttributeReportID)) {
const report = getReport(htmlAttributeReportID);

reportID = report?.reportID ?? undefined;
reportID = report?.reportID ?? htmlAttributeReportID;
mentionDisplayText = removeLeadingLTRAndHash(report?.reportName ?? report?.displayName ?? htmlAttributeReportID);
// Get mention details from name inside tnode
} else if ('data' in tnode && !isEmptyObject(tnode.data)) {
Expand All @@ -63,7 +62,9 @@ function MentionReportRenderer({style, tnode, TDefaultRenderer, reports, ...defa

const currentReportID = useCurrentReportID();
const currentReport = getReport(currentReportID?.currentReportID);
const isGroupPolicyReport = useMemo(() => (currentReport && !isEmptyObject(currentReport) ? ReportUtils.isGroupPolicy(currentReport) : false), [currentReport]);

// When we invite someone to a room they don't have the policy object, but we still want them to be able to see and click on report mentions, so we only check if the policyID in the report is from a workspace
const isGroupPolicyReport = useMemo(() => currentReport && !isEmptyObject(currentReport) && !!currentReport.policyID && currentReport.policyID !== CONST.POLICY.ID_FAKE, [currentReport]);

const mentionDetails = getMentionDetails(htmlAttributeReportID, currentReport, reports, tnode);
if (!mentionDetails) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,8 @@ function ReportActionCompose({
[],
);

const isGroupPolicyReport = useMemo(() => ReportUtils.isGroupPolicy(report), [report]);
// When we invite someone to a room they don't have the policy object, but we still want them to be able to mention other reports they are members of, so we only check if the policyID in the report is from a workspace
const isGroupPolicyReport = useMemo(() => !!report?.policyID && report.policyID !== CONST.POLICY.ID_FAKE, [report]);
const reportRecipientAcountIDs = ReportUtils.getReportRecipientAccountIDs(report, currentUserPersonalDetails.accountID);
const reportRecipient = personalDetails[reportRecipientAcountIDs[0]];
const shouldUseFocusedColor = !isBlockedFromConcierge && !disabled && isFocused;
Expand Down