Skip to content
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 Mobile-Expensify
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled rootProject.ext.multiDexEnabled
versionCode 1009035109
versionName "9.3.51-9"
versionCode 1009035110
versionName "9.3.51-10"
// Supported language variants must be declared here to avoid from being removed during the compilation.
// This also helps us to not include unnecessary language variants in the APK.
resConfigs "en", "es"
Expand Down
2 changes: 1 addition & 1 deletion ios/NewExpensify/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>9.3.51.9</string>
<string>9.3.51.10</string>
<key>FullStory</key>
<dict>
<key>OrgId</key>
Expand Down
2 changes: 1 addition & 1 deletion ios/NotificationServiceExtension/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<key>CFBundleShortVersionString</key>
<string>9.3.51</string>
<key>CFBundleVersion</key>
<string>9.3.51.9</string>
<string>9.3.51.10</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionPointIdentifier</key>
Expand Down
2 changes: 1 addition & 1 deletion ios/ShareViewController/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<key>CFBundleShortVersionString</key>
<string>9.3.51</string>
<key>CFBundleVersion</key>
<string>9.3.51.9</string>
<string>9.3.51.10</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionAttributes</key>
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "new.expensify",
"version": "9.3.51-9",
"version": "9.3.51-10",
"author": "Expensify, Inc.",
"homepage": "https://new.expensify.com",
"description": "New Expensify is the next generation of Expensify: a reimagination of payments based atop a foundation of chat.",
Expand Down
2 changes: 0 additions & 2 deletions src/components/LHNOptionsList/OptionRowLHNData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ function OptionRowLHNData({
const [conciergeReportID] = useOnyx(ONYXKEYS.CONCIERGE_REPORT_ID);
const {login} = useCurrentUserPersonalDetails();
const [policyTags] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY_TAGS}${fullReport?.policyID}`);
const [fullReportActions] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${fullReport?.reportID}`);

const card = useGetExpensifyCardFromReportAction({reportAction: lastAction, policyID: fullReport?.policyID});

Expand Down Expand Up @@ -156,7 +155,6 @@ function OptionRowLHNData({
reportAttributesDerived,
policyTags,
currentUserLogin: login ?? '',
reportActions: fullReportActions,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Conflict was here. We renamed this variable to fix TS. It was first introduced in the PR being reverted, so it should be removed here.

});

// For single-sender IOUs, trim to the sender's avatar to match the header.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ function MoneyRequestReportActionsList({
return;
}

if (isUnread(report, transactionThreadReport, isReportArchived, reportActionsObject) || (lastAction && isCurrentActionUnread(report, lastAction, visibleReportActions))) {
if (isUnread(report, transactionThreadReport, isReportArchived) || (lastAction && isCurrentActionUnread(report, lastAction, visibleReportActions))) {
// On desktop, when the notification center is displayed, isVisible will return false.
// Currently, there's no programmatic way to dismiss the notification center panel.
// To handle this, we use the 'referrer' parameter to check if the current navigation is triggered from a notification.
Expand Down
4 changes: 1 addition & 3 deletions src/libs/OptionsListUtils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2303,8 +2303,6 @@ function prepareReportOptionsForDisplay(
const report = option.item;
const policy = policiesCollection?.[`${ONYXKEYS.COLLECTION.POLICY}${report.policyID}`];
const reportPolicyTags = policyTags?.[`${ONYXKEYS.COLLECTION.POLICY_TAGS}${getNonEmptyStringOnyxID(report?.policyID)}`];
// eslint-disable-next-line @typescript-eslint/no-deprecated
const reportActions = deprecatedAllReportActions?.[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report.reportID}`];
/**
* By default, generated options does not have the chat preview line enabled.
* If showChatPreviewLine or forcePolicyNamePreview are true, let's generate and overwrite the alternate text.
Expand Down Expand Up @@ -2332,7 +2330,7 @@ function prepareReportOptionsForDisplay(
: undefined;
const oneTransactionThreadReport = oneTransactionThreadReportID ? allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${oneTransactionThreadReportID}`] : undefined;

isOptionUnread = isUnread(report, oneTransactionThreadReport, !!option.private_isArchived, reportActions) && !!report.lastActorAccountID;
isOptionUnread = isUnread(report, oneTransactionThreadReport, !!option.private_isArchived) && !!report.lastActorAccountID;
}

let lastIOUCreationDate;
Expand Down
35 changes: 3 additions & 32 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9093,32 +9093,8 @@ function generateIsEmptyReport(report: OnyxEntry<Report>, isReportArchived: bool
return !lastVisibleMessage.lastMessageText;
}

/**
* Get the latest report action from other users
* @param reportActions - The report actions
* @param accountID - The current user account ID (to exclude own actions)
* @returns The latest report action from other users
*/
function getLatestReportActionFromOtherUsers(reportActions: ReportActions | undefined, accountID: number | undefined): ReportAction | null {
if (!accountID) {
return null;
}

return Object.values(reportActions ?? {}).reduce((latest: ReportAction | null, current: ReportAction) => {
if (
!isDeletedAction(current) &&
current.actorAccountID !== accountID &&
(!latest || current.created > latest.created) &&
(!isWhisperAction(current) || current.actionName === CONST.REPORT.ACTIONS.TYPE.ACTIONABLE_MENTION_WHISPER)
) {
return current;
}
return latest;
}, null);
}

// We need oneTransactionThreadReport to get the correct last visible action created
function isUnread(report: OnyxEntry<Report>, oneTransactionThreadReport: OnyxEntry<Report>, isReportArchived: boolean | undefined, reportActions: ReportActions | undefined): boolean {
function isUnread(report: OnyxEntry<Report>, oneTransactionThreadReport: OnyxEntry<Report>, isReportArchived: boolean | undefined): boolean {
if (!report) {
return false;
}
Expand All @@ -9130,16 +9106,13 @@ function isUnread(report: OnyxEntry<Report>, oneTransactionThreadReport: OnyxEnt
if (!report.lastReadTime) {
return true;
}

const latestReportActionFromOtherUsers = getLatestReportActionFromOtherUsers(reportActions, deprecatedCurrentUserAccountID);

// lastVisibleActionCreated and lastReadTime are both datetime strings and can be compared directly
const lastVisibleActionCreated = getReportLastVisibleActionCreated(report, oneTransactionThreadReport);
const lastReadTime = report.lastReadTime ?? '';
const lastMentionedTime = report.lastMentionedTime ?? '';

// If the user was mentioned and the comment got deleted the lastMentionedTime will be more recent than the lastVisibleActionCreated
return lastReadTime < (lastVisibleActionCreated ?? '') || lastReadTime < lastMentionedTime || lastReadTime < (latestReportActionFromOtherUsers?.created ?? '');
return lastReadTime < (lastVisibleActionCreated ?? '') || lastReadTime < lastMentionedTime;
}

function isIOUOwnedByCurrentUser(report: OnyxEntry<Report>, allReportsDict?: OnyxCollection<Report>): boolean {
Expand Down Expand Up @@ -9727,8 +9700,7 @@ function reasonForReportToBeInOptionList({
if (isInFocusMode) {
const oneTransactionThreadReportID = getOneTransactionThreadReportID(report, chatReport, currentReportActions);
const oneTransactionThreadReport = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${oneTransactionThreadReportID}`];
const reportActions = allReportActions?.[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report?.reportID}`];
return isUnread(report, oneTransactionThreadReport, isReportArchived, reportActions) && getReportNotificationPreference(report) !== CONST.REPORT.NOTIFICATION_PREFERENCE.MUTE
return isUnread(report, oneTransactionThreadReport, isReportArchived) && getReportNotificationPreference(report) !== CONST.REPORT.NOTIFICATION_PREFERENCE.MUTE
? CONST.REPORT_IN_LHN_REASONS.IS_UNREAD
: null;
}
Expand Down Expand Up @@ -13876,7 +13848,6 @@ export {
getBillableAndTaxTotal,
getReportForHeader,
isReportOpenOrUnsubmitted,
getLatestReportActionFromOtherUsers,
getIconsForExpenseReport,
getTransactionSortValue,
isSortableColumnName,
Expand Down
4 changes: 1 addition & 3 deletions src/libs/SidebarUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,6 @@ function getOptionData({
reportAttributesDerived,
policyTags,
currentUserLogin,
reportActions,
}: {
report: OnyxEntry<Report>;
oneTransactionThreadReport: OnyxEntry<Report>;
Expand All @@ -721,7 +720,6 @@ function getOptionData({
reportAttributesDerived?: ReportAttributesDerivedValue['reports'];
policyTags?: OnyxEntry<PolicyTagLists>;
currentUserLogin: string;
reportActions?: ReportActions;
}): OptionData | undefined {
// When a user signs out, Onyx is cleared. Due to the lazy rendering with a virtual list, it's possible for
// this method to be called after the Onyx data has been cleared out. In that case, it's fine to do
Expand Down Expand Up @@ -802,7 +800,7 @@ function getOptionData({
result.statusNum = report.statusNum;
// When the only message of a report is deleted lastVisibleActionCreated is not reset leading to wrongly
// setting it Unread so we add additional condition here to avoid empty chat LHN from being bold.
result.isUnread = isUnread(report, oneTransactionThreadReport, isReportArchived, reportActions) && !!report.lastActorAccountID;
result.isUnread = isUnread(report, oneTransactionThreadReport, isReportArchived) && !!report.lastActorAccountID;
result.isUnreadWithMention = isUnreadWithMention(report);
result.isPinned = report.isPinned;
result.iouReportID = report.iouReportID;
Expand Down
3 changes: 1 addition & 2 deletions src/libs/UnreadIndicatorUpdater/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,9 @@ function getUnreadReportsForUnreadIndicator(reports: OnyxCollection<Report>, cur
const oneTransactionThreadReportID = getOneTransactionThreadReportID(report, chatReport, allReportActions?.[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report?.reportID}`]);
const oneTransactionThreadReport = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${oneTransactionThreadReportID}`];
const nameValuePairs = allReportNameValuePairs?.[`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${report?.reportID}`];
const reportActions = allReportActions?.[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report?.reportID}`];
const isReportArchived = ReportUtils.isArchivedReport(nameValuePairs);
return (
ReportUtils.isUnread(report, oneTransactionThreadReport, isReportArchived, reportActions) &&
ReportUtils.isUnread(report, oneTransactionThreadReport, isReportArchived) &&
ReportUtils.shouldReportBeInOptionList({
report,
chatReport,
Expand Down
3 changes: 1 addition & 2 deletions src/libs/actions/Report/MarkAllMessageAsRead.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ function markAllMessagesAsRead(archivedReportsIdSet: ArchivedReportsIDSet) {
const oneTransactionThreadReportID = getOneTransactionThreadReportID(report, chatReport, allReportActions?.[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report.reportID}`]);
const oneTransactionThreadReport = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${oneTransactionThreadReportID}`];
const isArchivedReport = archivedReportsIdSet.has(`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${report.reportID}`);
const reportActions = allReportActions?.[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report.reportID}`];
if (!isUnread(report, oneTransactionThreadReport, isArchivedReport, reportActions)) {
if (!isUnread(report, oneTransactionThreadReport, isArchivedReport)) {
continue;
}

Expand Down
33 changes: 13 additions & 20 deletions src/libs/actions/Report/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ import {
getChildReportNotificationPreference,
getDefaultNotificationPreferenceForReport,
getLastVisibleMessage,
getLatestReportActionFromOtherUsers,
getNextApproverAccountID,
getOptimisticDataForAncestors,
getOriginalReportID,
Expand Down Expand Up @@ -2338,7 +2337,18 @@ function markCommentAsUnread(reportID: string | undefined, reportActions: OnyxEn
}

// Find the latest report actions from other users
const latestReportActionFromOtherUsers = getLatestReportActionFromOtherUsers(reportActions, currentUserAccountID);
const latestReportActionFromOtherUsers = Object.values(reportActions ?? {}).reduce((latest: ReportAction | null, current: ReportAction) => {
if (
!ReportActionsUtils.isDeletedAction(current) &&
current.actorAccountID !== currentUserAccountID &&
(!latest || current.created > latest.created) &&
// Whisper action doesn't affect lastVisibleActionCreated, so skip whisper action except actionable mention whisper
(!ReportActionsUtils.isWhisperAction(current) || current.actionName === CONST.REPORT.ACTIONS.TYPE.ACTIONABLE_MENTION_WHISPER)
) {
return current;
}
return latest;
}, null);

const report = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`];
const chatReport = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${report?.chatReportID}`];
Expand All @@ -2354,29 +2364,12 @@ function markCommentAsUnread(reportID: string | undefined, reportActions: OnyxEn
// Since the report action with ID 100 will be the first with a timestamp above '2014-04-01 16:07:02.998', it's the first one that will be shown as unread
const lastReadTime = DateUtils.subtractMillisecondsFromDateTime(actionCreationTime, 1);

const lastActorAccountID =
reportAction?.actorAccountID && reportAction.actorAccountID !== currentUserAccountID
? reportAction.actorAccountID
: (latestReportActionFromOtherUsers?.actorAccountID ?? report?.lastActorAccountID);

const optimisticData: Array<OnyxUpdate<typeof ONYXKEYS.COLLECTION.REPORT>> = [
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT}${reportID}`,
value: {
lastReadTime,
...(lastActorAccountID !== undefined && {lastActorAccountID}),
},
},
];

const failureData: Array<OnyxUpdate<typeof ONYXKEYS.COLLECTION.REPORT>> = [
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT}${reportID}`,
value: {
lastReadTime: report?.lastReadTime,
lastActorAccountID: report?.lastActorAccountID,
},
},
];
Expand All @@ -2387,7 +2380,7 @@ function markCommentAsUnread(reportID: string | undefined, reportActions: OnyxEn
reportActionID: reportAction?.reportActionID,
};

API.write(WRITE_COMMANDS.MARK_AS_UNREAD, parameters, {optimisticData, failureData});
API.write(WRITE_COMMANDS.MARK_AS_UNREAD, parameters, {optimisticData});
DeviceEventEmitter.emit(`unreadAction_${reportID}`, lastReadTime);
}

Expand Down
2 changes: 1 addition & 1 deletion src/pages/inbox/report/ReportActionsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ function ReportActionsList({
return;
}

if (isUnread(report, transactionThreadReport, isReportArchived, reportActionsFromOnyx) || (lastAction && isCurrentActionUnread(report, lastAction, sortedVisibleReportActions))) {
if (isUnread(report, transactionThreadReport, isReportArchived) || (lastAction && isCurrentActionUnread(report, lastAction, sortedVisibleReportActions))) {
// On desktop, when the notification center is displayed, isVisible will return false.
// Currently, there's no programmatic way to dismiss the notification center panel.
// To handle this, we use the 'referrer' parameter to check if the current navigation is triggered from a notification.
Expand Down
Loading
Loading