Skip to content

Commit

Permalink
Merge branch 'marcaaron-getReportSummaryList' of github.com:Expensify…
Browse files Browse the repository at this point in the history
…/Expensify.cash into marcaaron-getReportSummaryList
  • Loading branch information
marcaaron committed Jul 13, 2021
2 parents 9749853 + a325691 commit 517c794
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/libs/actions/Report.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,22 +161,22 @@ function getChatReportName(fullReport, chatType) {
* @returns {Object}
*/
function getSimplifiedReportObject(report) {
const lastReportAction = !_.isEmpty(report.mostRecentReportAction) ? report.mostRecentReportAction : null;
const createTimestamp = lastReportAction ? lastReportAction.created : 0;
const createTimestamp = lodashGet(report, 'lastActionCreated', 0);
const lastMessageTimestamp = moment.utc(createTimestamp).unix();
const isLastMessageAttachment = /<img([^>]+)\/>/gi.test(lodashGet(lastReportAction, ['message', 'html'], ''));
const lastActionMessage = lodashGet(report, ['lastActionMessage', 'html'], '');
const isLastMessageAttachment = /<img([^>]+)\/>/gi.test(lastActionMessage);
const chatType = lodashGet(report, ['reportNameValuePairs', 'chatType'], '');

// We are removing any html tags from the message html since we cannot access the text version of any comments as
// the report only has the raw reportActionList and not the processed version returned by Report_GetHistory
// We convert the line-breaks in html to space ' ' before striping the tags
const lastMessageText = lodashGet(lastReportAction, ['message', 'html'], '')
const lastMessageText = lastActionMessage
.replace(/((<br[^>]*>)+)/gi, ' ')
.replace(/(<([^>]+)>)/gi, '') || `[${translateLocal('common.deletedCommentMessage')}]`;
const reportName = lodashGet(report, ['reportNameValuePairs', 'type']) === 'chat'
? getChatReportName(report, chatType)
: report.reportName;
const lastActorEmail = lodashGet(lastReportAction, 'accountEmail', '');
const lastActorEmail = lodashGet(report, 'lastActionActorEmail', '');
const notificationPreference = isDefaultRoom({chatType})
? lodashGet(report, ['reportNameValuePairs', 'notificationPreferences', currentUserAccountID], 'daily')
: '';
Expand All @@ -188,7 +188,7 @@ function getSimplifiedReportObject(report) {
ownerEmail: lodashGet(report, ['ownerEmail'], ''),
policyID: lodashGet(report, ['reportNameValuePairs', 'expensify_policyID'], ''),
unreadActionCount: getUnreadActionCount(report),
maxSequenceNumber: report.reportActionListLength,
maxSequenceNumber: lodashGet(report, 'reportActionCount', 0),
participants: getParticipantEmailsFromReport(report),
isPinned: report.isPinned,
lastVisitedTimestamp: lodashGet(report, [
Expand Down

0 comments on commit 517c794

Please sign in to comment.