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

Track expense/self dm #37165

Merged
merged 43 commits into from
Mar 2, 2024
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
500f458
added v1 changes
ishpaul777 Feb 15, 2024
07eb0d9
Merge branch 'Expensify:main' into trackExpense/selfDM
ishpaul777 Feb 16, 2024
7819bc1
Merge branch 'Expensify:main' into trackExpense/selfDM
ishpaul777 Feb 23, 2024
376b452
clean up and changes v2
ishpaul777 Feb 23, 2024
f16a19f
fixes selfDm reportName in LHN
ishpaul777 Feb 23, 2024
ad25805
show report in detination for tasks
ishpaul777 Feb 23, 2024
f6362ad
prettier diffs
ishpaul777 Feb 23, 2024
e120e7a
Merge branch 'Expensify:main' into trackExpense/selfDM
ishpaul777 Feb 25, 2024
ef11187
Merge branch 'main' into trackExpense/selfDM
ishpaul777 Feb 29, 2024
8d002ca
refactor after merge
ishpaul777 Feb 29, 2024
4ac87bb
prettier
ishpaul777 Feb 29, 2024
c8ae559
fixes leave option in header three dots
ishpaul777 Feb 29, 2024
9426035
fix conflicts after merge
ishpaul777 Feb 29, 2024
5d7a997
fix postfix for visible for self dm
ishpaul777 Feb 29, 2024
279592b
fix user-avatar an share destination issue
ishpaul777 Feb 29, 2024
266cea6
remove console log
ishpaul777 Feb 29, 2024
3d4e4c7
fixes infinite loading when first load
ishpaul777 Feb 29, 2024
02db6f0
fixes review comments
ishpaul777 Mar 1, 2024
806c248
fixes self dm not showing in lhn
ishpaul777 Mar 1, 2024
d834b4f
remove console log
ishpaul777 Mar 1, 2024
01379eb
fixes ts checks
ishpaul777 Mar 1, 2024
1964a61
Merge branch 'Expensify:main' into trackExpense/selfDM
ishpaul777 Mar 1, 2024
c6b2614
fixes private note comment
ishpaul777 Mar 1, 2024
2e30497
remove unnecessary whitespace change
ishpaul777 Mar 1, 2024
144fb48
fixes spanish translation
ishpaul777 Mar 1, 2024
339a6a8
fixes comment
ishpaul777 Mar 1, 2024
5acf3c8
Update src/libs/ReportUtils.ts
ishpaul777 Mar 1, 2024
01820f8
getMoneyRequestOptions
ishpaul777 Mar 1, 2024
4df1a51
Merge branch 'trackExpense/selfDM' of https://github.com/ishpaul777/A…
ishpaul777 Mar 1, 2024
e1cd7cc
modify for readibility
ishpaul777 Mar 1, 2024
f33be37
remove comments
ishpaul777 Mar 1, 2024
c0b06bb
fixes you postfix not showing up in profilepage
ishpaul777 Mar 2, 2024
c8e1e02
fixes comment as per suggestion
ishpaul777 Mar 2, 2024
c812725
formatting
ishpaul777 Mar 2, 2024
acfdae8
Merge branch 'trackExpense/selfDM' of https://github.com/ishpaul777/A…
ishpaul777 Mar 2, 2024
db38f3b
revert back changes
ishpaul777 Mar 2, 2024
68a348f
Update src/pages/ReportDetailsPage.tsx
ishpaul777 Mar 2, 2024
5d167b0
Update src/pages/home/HeaderView.js
ishpaul777 Mar 2, 2024
a67cbc8
Update src/libs/OptionsListUtils.ts
ishpaul777 Mar 2, 2024
80a0e44
fixes review comment
ishpaul777 Mar 2, 2024
ac5030f
Merge branch 'trackExpense/selfDM' of https://github.com/ishpaul777/A…
ishpaul777 Mar 2, 2024
a4d858f
lint fix
ishpaul777 Mar 2, 2024
5cfb38d
add comment for workaround
ishpaul777 Mar 2, 2024
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
1 change: 1 addition & 0 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,7 @@ const CONST = {
DOMAIN_ALL: 'domainAll',
POLICY_ROOM: 'policyRoom',
POLICY_EXPENSE_CHAT: 'policyExpenseChat',
SELF_DM: 'selfDM',
},
WORKSPACE_CHAT_ROOMS: {
ANNOUNCE: '#announce',
Expand Down
27 changes: 22 additions & 5 deletions src/components/ReportWelcomeText.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, {useMemo} from 'react';
import {View} from 'react-native';
import type {OnyxEntry} from 'react-native-onyx';
import {withOnyx} from 'react-native-onyx';
Expand Down Expand Up @@ -35,7 +35,8 @@ function ReportWelcomeText({report, policy, personalDetails}: ReportWelcomeTextP
const styles = useThemeStyles();
const isPolicyExpenseChat = ReportUtils.isPolicyExpenseChat(report);
const isChatRoom = ReportUtils.isChatRoom(report);
const isDefault = !(isChatRoom || isPolicyExpenseChat);
const isSelfDM = ReportUtils.isSelfDM(report);
const isDefault = !(isChatRoom || isPolicyExpenseChat || isSelfDM);
const participantAccountIDs = report?.participantAccountIDs ?? [];
const isMultipleParticipant = participantAccountIDs.length > 1;
const displayNamesWithTooltips = ReportUtils.getDisplayNamesWithTooltips(OptionsListUtils.getPersonalDetailsForAccountIDs(participantAccountIDs, personalDetails), isMultipleParticipant);
Expand All @@ -44,6 +45,7 @@ function ReportWelcomeText({report, policy, personalDetails}: ReportWelcomeTextP
const moneyRequestOptions = ReportUtils.getMoneyRequestOptions(report, policy, participantAccountIDs);
const additionalText = moneyRequestOptions.map((item) => translate(`reportActionsView.iouTypes.${item}`)).join(', ');
const canEditPolicyDescription = ReportUtils.canEditPolicyDescription(policy);
const reportName = ReportUtils.getReportName(report);

const navigateToReport = () => {
if (!report?.reportID) {
Expand All @@ -53,12 +55,22 @@ function ReportWelcomeText({report, policy, personalDetails}: ReportWelcomeTextP
Navigation.navigate(ROUTES.REPORT_WITH_ID_DETAILS.getRoute(report.reportID));
};

const getWelcomeHeroText = useMemo(() => {
if (isChatRoom) {
ishpaul777 marked this conversation as resolved.
Show resolved Hide resolved
return translate('reportActionsView.welcomeToRoom', {roomName: reportName});
}

if (isSelfDM) {
return translate('reportActionsView.yourSpace');
}

return translate('reportActionsView.sayHello');
}, [isChatRoom, isSelfDM, translate, reportName]);

return (
<>
<View>
<Text style={[styles.textHero]}>
{isChatRoom ? translate('reportActionsView.welcomeToRoom', {roomName: ReportUtils.getReportName(report)}) : translate('reportActionsView.sayHello')}
</Text>
<Text style={[styles.textHero]}>{getWelcomeHeroText}</Text>
</View>
<View style={[styles.mt3, styles.mw100]}>
{isPolicyExpenseChat && (
Expand Down Expand Up @@ -120,6 +132,11 @@ function ReportWelcomeText({report, policy, personalDetails}: ReportWelcomeTextP
)}
</>
)}
{isSelfDM && (
<Text>
<Text>{translate('reportActionsView.beginningOfChatHistorySelfDM')}</Text>
</Text>
)}
{isDefault && (
<Text>
<Text>{translate('reportActionsView.beginningOfChatHistory')}</Text>
Expand Down
3 changes: 3 additions & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -492,8 +492,11 @@ export default {
beginningOfChatHistoryPolicyExpenseChatPartOne: 'Collaboration between ',
beginningOfChatHistoryPolicyExpenseChatPartTwo: ' and ',
beginningOfChatHistoryPolicyExpenseChatPartThree: ' starts here! 🎉 This is the place to chat, request money and settle up.',
// todo: confirm this copy
beginningOfChatHistorySelfDM: 'This is your personal space. Use it to chat with yourself, take notes, or save links.',
chatWithAccountManager: 'Chat with your account manager here',
sayHello: 'Say hello!',
yourSpace: 'Your space',
welcomeToRoom: ({roomName}: WelcomeToRoomParams) => `Welcome to ${roomName}!`,
usePlusButton: ({additionalText}: UsePlusButtonParams) => `\nYou can also use the + button to ${additionalText}, or assign a task!`,
iouTypes: {
Expand Down
4 changes: 4 additions & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -485,8 +485,12 @@ export default {
beginningOfChatHistoryPolicyExpenseChatPartOne: '¡La colaboración entre ',
beginningOfChatHistoryPolicyExpenseChatPartTwo: ' y ',
beginningOfChatHistoryPolicyExpenseChatPartThree: ' empieza aquí! 🎉 Este es el lugar donde chatear, pedir dinero y pagar.',
// todo: confirm this copy and ask for the correct translation
beginningOfChatHistorySelfDM: 'This is your personal space. Use it to chat with yourself, take notes, or save links.',
chatWithAccountManager: 'Chatea con tu gestor de cuenta aquí',
sayHello: '¡Saluda!',
// todo: ask for the correct translation
yourSpace: 'Your space',
welcomeToRoom: ({roomName}: WelcomeToRoomParams) => `¡Bienvenido a ${roomName}!`,
usePlusButton: ({additionalText}: UsePlusButtonParams) => `\n¡También puedes usar el botón + de abajo para ${additionalText}, o asignar una tarea!`,
iouTypes: {
Expand Down
13 changes: 13 additions & 0 deletions src/libs/OptionsListUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ type GetOptionsConfig = {
includeMultipleParticipantReports?: boolean;
includePersonalDetails?: boolean;
includeRecentReports?: boolean;
includeSelfDM?: boolean;
sortByReportTypeInSearch?: boolean;
searchInputValue?: string;
showChatPreviewLine?: boolean;
Expand Down Expand Up @@ -665,6 +666,8 @@ function createOption(
result.tooltipText = ReportUtils.getReportParticipantsTitle(report.visibleChatMemberAccountIDs ?? []);
result.isWaitingOnBankAccount = report.isWaitingOnBankAccount;
result.policyID = report.policyID;
result.isSelfDM = ReportUtils.isSelfDM(report);

hasMultipleParticipants = personalDetailList.length > 1 || result.isChatRoom || result.isPolicyExpenseChat;
subtitle = ReportUtils.getChatRoomSubtitle(report);

Expand Down Expand Up @@ -1361,6 +1364,7 @@ function getOptions(
transactionViolations = {},
includePolicyTaxRates,
policyTaxRates,
includeSelfDM = false,
}: GetOptionsConfig,
): GetOptions {
if (includeCategories) {
Expand Down Expand Up @@ -1465,6 +1469,7 @@ function getOptions(
const isTaskReport = ReportUtils.isTaskReport(report);
const isPolicyExpenseChat = ReportUtils.isPolicyExpenseChat(report);
const isMoneyRequestReport = ReportUtils.isMoneyRequestReport(report);
const isSelfDM = ReportUtils.isSelfDM(report);
const accountIDs = report.visibleChatMemberAccountIDs ?? [];
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment for reference


if (isPolicyExpenseChat && report.isOwnPolicyExpenseChat && !includeOwnedWorkspaceChats) {
Expand All @@ -1476,6 +1481,10 @@ function getOptions(
return;
}

if (isSelfDM && !includeSelfDM) {
return;
}

if (isThread && !includeThreads) {
return;
}
Expand Down Expand Up @@ -1726,6 +1735,7 @@ function getSearchOptions(reports: Record<string, Report>, personalDetails: Onyx
includeThreads: true,
includeMoneyRequests: true,
includeTasks: true,
includeSelfDM: true,
});
Timing.end(CONST.TIMING.LOAD_SEARCH_OPTIONS);
Performance.markEnd(CONST.TIMING.LOAD_SEARCH_OPTIONS);
Expand Down Expand Up @@ -1801,6 +1811,7 @@ function getFilteredOptions(
includeSelectedOptions = false,
includePolicyTaxRates = false,
policyTaxRates: PolicyTaxRateWithDefault = {} as PolicyTaxRateWithDefault,
includeSelfDM = false,
) {
return getOptions(reports, personalDetails, {
betas,
Expand All @@ -1822,6 +1833,7 @@ function getFilteredOptions(
includeSelectedOptions,
includePolicyTaxRates,
policyTaxRates,
includeSelfDM,
});
}

Expand Down Expand Up @@ -1855,6 +1867,7 @@ function getShareDestinationOptions(
excludeLogins,
includeOwnedWorkspaceChats,
excludeUnknownUsers,
includeSelfDM: true,
});
}

Expand Down
9 changes: 7 additions & 2 deletions src/libs/PersonalDetailsUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,14 @@ Onyx.connect({
},
});

function getDisplayNameOrDefault(passedPersonalDetails?: Partial<PersonalDetails> | null, defaultValue = '', shouldFallbackToHidden = true): string {
const displayName = passedPersonalDetails?.displayName ? passedPersonalDetails.displayName.replace(CONST.REGEX.MERGED_ACCOUNT_PREFIX, '') : '';
function getDisplayNameOrDefault(passedPersonalDetails?: Partial<PersonalDetails> | null, defaultValue = '', shouldFallbackToHidden = true, shouldAddCurrentUserPostfix = false): string {
let displayName = passedPersonalDetails?.displayName ? passedPersonalDetails.displayName.replace(CONST.REGEX.MERGED_ACCOUNT_PREFIX, '') : '';
if (shouldAddCurrentUserPostfix) {
displayName = `${displayName} (${Localize.translateLocal('common.you').toLowerCase()})`;
}
ishpaul777 marked this conversation as resolved.
Show resolved Hide resolved

const fallbackValue = shouldFallbackToHidden ? Localize.translateLocal('common.hidden') : '';

return displayName || defaultValue || fallbackValue;
}

Expand Down
31 changes: 24 additions & 7 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,7 @@ type OptionData = {
notificationPreference?: NotificationPreference | null;
isDisabled?: boolean | null;
name?: string | null;
isSelfDM?: boolean | null;
} & Report;

type OnyxDataTaskAssigneeChat = {
Expand Down Expand Up @@ -910,6 +911,10 @@ function isDM(report: OnyxEntry<Report>): boolean {
return isChatReport(report) && !getChatType(report);
}

function isSelfDM(report: OnyxEntry<Report>): boolean {
return getChatType(report) === CONST.REPORT.CHAT_TYPE.SELF_DM;
}

/**
* Only returns true if this is our main 1:1 DM report with Concierge
*/
Expand Down Expand Up @@ -1644,7 +1649,7 @@ function getPersonalDetailsForAccountID(accountID: number): Partial<PersonalDeta
/**
* Get the displayName for a single report participant.
*/
function getDisplayNameForParticipant(accountID?: number, shouldUseShortForm = false, shouldFallbackToHidden = true): string {
function getDisplayNameForParticipant(accountID?: number, shouldUseShortForm = false, shouldFallbackToHidden = true, shouldAddCurrentUserPostfix = false): string {
if (!accountID) {
return '';
}
Expand All @@ -1659,7 +1664,9 @@ function getDisplayNameForParticipant(accountID?: number, shouldUseShortForm = f
return formattedLogin;
}

const longName = PersonalDetailsUtils.getDisplayNameOrDefault(personalDetails, formattedLogin, shouldFallbackToHidden);
// todo: remove this once we have a better way to handle this
ishpaul777 marked this conversation as resolved.
Show resolved Hide resolved
const shouldAddPostfix = shouldAddCurrentUserPostfix && accountID !== currentUserAccountID;
ishpaul777 marked this conversation as resolved.
Show resolved Hide resolved
const longName = PersonalDetailsUtils.getDisplayNameOrDefault(personalDetails, formattedLogin, shouldFallbackToHidden, shouldAddPostfix);

// If the user's personal details (first name) should be hidden, make sure we return "hidden" instead of the short name
if (shouldFallbackToHidden && longName === Localize.translateLocal('common.hidden')) {
Expand All @@ -1674,14 +1681,15 @@ function getDisplayNamesWithTooltips(
personalDetailsList: PersonalDetails[] | PersonalDetailsList | OptionData[],
isMultipleParticipantReport: boolean,
shouldFallbackToHidden = true,
shouldAddCurrentUserPostfix = false,
): DisplayNameWithTooltips {
const personalDetailsListArray = Array.isArray(personalDetailsList) ? personalDetailsList : Object.values(personalDetailsList);

return personalDetailsListArray
.map((user) => {
const accountID = Number(user?.accountID);
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
const displayName = getDisplayNameForParticipant(accountID, isMultipleParticipantReport, shouldFallbackToHidden) || user?.login || '';
const displayName = getDisplayNameForParticipant(accountID, isMultipleParticipantReport, shouldFallbackToHidden, shouldAddCurrentUserPostfix) || user?.login || '';
const avatar = UserUtils.getDefaultAvatar(accountID);

let pronouns = user?.pronouns ?? undefined;
Expand Down Expand Up @@ -2564,6 +2572,10 @@ function getReportName(report: OnyxEntry<Report>, policy: OnyxEntry<Policy> = nu
formattedName += ` (${Localize.translateLocal('common.archived')})`;
}

if (isSelfDM(report)) {
formattedName = getDisplayNameForParticipant(report?.participantAccountIDs?.[0], undefined, undefined, true);
}

if (formattedName) {
return formattedName;
}
Expand Down Expand Up @@ -2654,7 +2666,7 @@ function getParentNavigationSubtitle(report: OnyxEntry<Report>): ParentNavigatio
function navigateToDetailsPage(report: OnyxEntry<Report>) {
const participantAccountIDs = report?.participantAccountIDs ?? [];

if (isOneOnOneChat(report)) {
if (isOneOnOneChat(report) || isSelfDM(report)) {
Navigation.navigate(ROUTES.PROFILE.getRoute(participantAccountIDs[0]));
return;
}
Expand Down Expand Up @@ -4226,7 +4238,7 @@ function hasIOUWaitingOnCurrentUserBankAccount(chatReport: OnyxEntry<Report>): b
*/
function canRequestMoney(report: OnyxEntry<Report>, policy: OnyxEntry<Policy>, otherParticipants: number[]): boolean {
// User cannot request money in chat thread or in task report or in chat room
if (isChatThread(report) || isTaskReport(report) || isChatRoom(report)) {
if (isChatThread(report) || isTaskReport(report) || isChatRoom(report) || isSelfDM(report)) {
return false;
}

Expand Down Expand Up @@ -4306,7 +4318,11 @@ function getMoneyRequestOptions(report: OnyxEntry<Report>, policy: OnyxEntry<Pol
// unless there are no other participants at all (e.g. #admins room for a policy with only 1 admin)
// DM chats will have the Split Bill option only when there are at least 2 other people in the chat.
// Your own workspace chats will have the split bill option.
if ((isChatRoom(report) && otherParticipants.length > 0) || (isDM(report) && hasMultipleOtherParticipants) || (isPolicyExpenseChat(report) && report?.isOwnPolicyExpenseChat)) {
if (
(isChatRoom(report) && otherParticipants.length > 0) ||
(isDM(report) && hasMultipleOtherParticipants) ||
(isPolicyExpenseChat(report) && report?.isOwnPolicyExpenseChat && !isSelfDM(report))
) {
options = [CONST.IOU.TYPE.SPLIT];
}

Expand All @@ -4315,7 +4331,7 @@ function getMoneyRequestOptions(report: OnyxEntry<Report>, policy: OnyxEntry<Pol
}

// Send money option should be visible only in 1:1 DMs
if (isDM(report) && hasSingleOtherParticipantInReport) {
if (isDM(report) && hasSingleOtherParticipantInReport && !isSelfDM(report)) {
ishpaul777 marked this conversation as resolved.
Show resolved Hide resolved
options = [...options, CONST.IOU.TYPE.SEND];
}

Expand Down Expand Up @@ -5168,6 +5184,7 @@ export {
getAddWorkspaceRoomOrChatReportErrors,
getReportOfflinePendingActionAndErrors,
isDM,
isSelfDM,
getPolicy,
getPolicyExpenseChatReportIDByOwner,
getWorkspaceChats,
Expand Down
8 changes: 7 additions & 1 deletion src/libs/SidebarUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ function getOptionData({
result.isAllowedToComment = ReportUtils.canUserPerformWriteAction(report);
result.chatType = report.chatType;
result.isDeletedParentAction = report.isDeletedParentAction;
result.isSelfDM = ReportUtils.isSelfDM(report);

const hasMultipleParticipants = participantPersonalDetailList.length > 1 || result.isChatRoom || result.isPolicyExpenseChat || ReportUtils.isExpenseReport(report);
const subtitle = ReportUtils.getChatRoomSubtitle(report);
Expand All @@ -267,7 +268,12 @@ function getOptionData({
const formattedLogin = Str.isSMSLogin(login) ? LocalePhoneNumber.formatPhoneNumber(login) : login;

// We only create tooltips for the first 10 users or so since some reports have hundreds of users, causing performance to degrade.
const displayNamesWithTooltips = ReportUtils.getDisplayNamesWithTooltips((participantPersonalDetailList || []).slice(0, 10), hasMultipleParticipants);
const displayNamesWithTooltips = ReportUtils.getDisplayNamesWithTooltips(
(participantPersonalDetailList || []).slice(0, 10),
hasMultipleParticipants,
undefined,
ReportUtils.isSelfDM(report),
);

// If the last actor's details are not currently saved in Onyx Collection,
// then try to get that from the last report action if that action is valid
Expand Down
11 changes: 6 additions & 5 deletions src/pages/ProfilePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,10 @@ const getPhoneNumber = (details) => {
function ProfilePage(props) {
const styles = useThemeStyles();
const accountID = Number(lodashGet(props.route.params, 'accountID', 0));
const details = lodashGet(props.personalDetails, accountID, ValidationUtils.isValidAccountRoute(accountID) ? {} : {isloading: false});
const isSelfDM = ReportUtils.isSelfDM(props.report);
ishpaul777 marked this conversation as resolved.
Show resolved Hide resolved

const displayName = PersonalDetailsUtils.getDisplayNameOrDefault(details);
const details = lodashGet(props.personalDetails, accountID, ValidationUtils.isValidAccountRoute(accountID) ? {} : {isloading: false});
const displayName = PersonalDetailsUtils.getDisplayNameOrDefault(details, undefined, undefined, isSelfDM);
const avatar = lodashGet(details, 'avatar', UserUtils.getDefaultAvatar());
const fallbackIcon = lodashGet(details, 'fallbackIcon', '');
const login = lodashGet(details, 'login', '');
Expand Down Expand Up @@ -133,7 +134,7 @@ function ProfilePage(props) {

const navigateBackTo = lodashGet(props.route, 'params.backTo');

const shouldShowNotificationPreference = !_.isEmpty(props.report) && props.report.notificationPreference !== CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN;
const shouldShowNotificationPreference = !_.isEmpty(props.report) && props.report.notificationPreference !== CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN && !isSelfDM;
ishpaul777 marked this conversation as resolved.
Show resolved Hide resolved
const notificationPreference = shouldShowNotificationPreference ? props.translate(`notificationPreferencesPage.notificationPreferences.${props.report.notificationPreference}`) : '';

// eslint-disable-next-line rulesdir/prefer-early-return
Expand Down Expand Up @@ -227,7 +228,7 @@ function ProfilePage(props) {
wrapperStyle={[styles.mtn6, styles.mb5]}
/>
)}
{!isCurrentUser && !Session.isAnonymousUser() && (
{!isCurrentUser && !Session.isAnonymousUser() && !isSelfDM && (
<MenuItem
title={`${props.translate('common.message')}${displayName}`}
titleStyle={styles.flex1}
Expand All @@ -237,7 +238,7 @@ function ProfilePage(props) {
shouldShowRightIcon
/>
)}
{!_.isEmpty(props.report) && (
{!_.isEmpty(props.report) && !isSelfDM && (
<MenuItem
title={`${props.translate('privateNotes.title')}`}
titleStyle={styles.flex1}
Expand Down
Loading
Loading