-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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 endless loading thread report header #42504
Conversation
Signed-off-by: Tsaqif <tsaiinkwa@yahoo.com>
Signed-off-by: Tsaqif <tsaiinkwa@yahoo.com>
src/libs/ReportUtils.ts
Outdated
accountIds.forEach((id, index) => (accountIdToName[id] = logins[index])); | ||
|
||
const parser = new ExpensiMark(); | ||
return parser.htmlToText(html, {reportIdToName}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am using ExpensiMark.htmltoText instead of my original code.
But there is typecheck error for accountIdToName
of extras in here. The field must be accountIdToName
and not accountIDToName
.
The typecheck will fails if I include accountIdToName
in this line. This also need changes in ExpensiMark.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to include accountIdToName
, don't we?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@luacmartins Yes, but there will be lint error if I used accountIdToName
.
the field is defined as accountIDName
in here.
But in the the javascript function it uses accountIdName
with lower d
in here.
Should I make changes in ExpensiMark
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, let's do it.
src/libs/ReportUtils.ts
Outdated
const mentionReportRegex = /<mention-report reportID="(\d+)" *\/>/gi; | ||
const matches = html.matchAll(mentionReportRegex); | ||
|
||
const reportIdToName: Record<string, string> = {}; | ||
for (const match of matches) { | ||
if (match[1] !== reportID) { | ||
// eslint-disable-next-line @typescript-eslint/no-use-before-define | ||
reportIdToName[match[1]] = getReportName(getReport(match[1])) ?? ''; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of searching for mentioned room name id before parsing, we could pass callback (id) => getReportName(getReport(id))
into extras. In here.
But this will need changes in ExpensiMark.js
@mollfpr PR is ready for review.... |
Also, since thread report will be displayed in LHN, the function |
Signed-off-by: Tsaqif <tsaiinkwa@yahoo.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good overall. Left a few comments though.
src/libs/ReportUtils.ts
Outdated
const mentionReportRegex = /<mention-report reportID="(\d+)" *\/>/gi; | ||
const matches = html.matchAll(mentionReportRegex); | ||
|
||
const reportIdToName: Record<string, string> = {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const reportIdToName: Record<string, string> = {}; | |
const reportIDToName: Record<string, string> = {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@luacmartins I am following the ExpensiMark field name in here.
If I use reportIDToName it doesn't work.
src/libs/ReportUtils.ts
Outdated
} | ||
|
||
const mentionUserRegex = /<mention-user accountID="(\d+)" *\/>/gi; | ||
const accountIdToName: Record<string, string> = {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const accountIdToName: Record<string, string> = {}; | |
const accountIDToName: Record<string, string> = {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and also with accountIdToName
in here
src/libs/ReportUtils.ts
Outdated
|
||
const mentionUserRegex = /<mention-user accountID="(\d+)" *\/>/gi; | ||
const accountIdToName: Record<string, string> = {}; | ||
const accountIds = Array.from(html.matchAll(mentionUserRegex), (m) => Number(m[1])); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const accountIds = Array.from(html.matchAll(mentionUserRegex), (m) => Number(m[1])); | |
const accountIDs = Array.from(html.matchAll(mentionUserRegex), (mention) => Number(mention[1])); |
src/libs/ReportUtils.ts
Outdated
@@ -487,6 +487,7 @@ let currentUserEmail: string | undefined; | |||
let currentUserPrivateDomain: string | undefined; | |||
let currentUserAccountID: number | undefined; | |||
let isAnonymousUser = false; | |||
const reportActionMessageCache: Record<string, string> = {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's leave a comment explaining why we need this cache map
src/libs/ReportUtils.ts
Outdated
accountIds.forEach((id, index) => (accountIdToName[id] = logins[index])); | ||
|
||
const parser = new ExpensiMark(); | ||
return parser.htmlToText(html, {reportIdToName}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to include accountIdToName
, don't we?
Bump for review @mollfpr |
Reviewer Checklist
Screenshots/VideosAndroid: Native42504.Android.mp4Android: mWeb Chrome42504.mWeb-Chrome.mp4iOS: Native42504.iOS.moviOS: mWeb Safari42504.mWeb-Safari.movMacOS: Chrome / Safari42504.Web.mp4MacOS: Desktop42504.Desktop.mp4 |
…function Signed-off-by: Tsaqif <tsaiinkwa@yahoo.com>
@mollfpr I have made a PR in expensify common: Expensify/expensify-common#708 to fix the typecheck error |
Signed-off-by: Tsaqif <tsaiinkwa@yahoo.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Waiting on the expensify-common PR to be merged so we can bump up the version here and test this again
@tsa321 I merged the |
@luacmartins @mollfpr the new release of Expensify-Common will be published to npm (I think by this Expensify/expensify-common#699 ). After that commit, the expensify-common lib folder won't be included in expensify-common folder inside node_modules. and PR: #42387 will migrate all import usage of expensify-common. |
PR that upgrades expensify-common is ready. Just to clarify it won't be import {ExpensiMark} from 'expensify-common';
//or
import ExpensiMark from 'expensify-common/dist/ExpensiMark'; |
@tsa321 can you update the PR to use the new expensify-common version? |
@luacmartins I think we are holding on #42387 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still holding on #42387
@tsa321 @luacmartins #42387 was just merged 🚀 |
Nice! Let's continue work on this PR @tsa321 |
Signed-off-by: Tsaqif <tsaiinkwa@yahoo.com>
@mollfpr Expensify-Common has been updated and I have merged main. PR is ready for review... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
All yours @luacmartins
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to production by https://github.com/luacmartins in version: 1.4.81-11 🚀
|
Details
Fixed Issues
$ #40928
PROPOSAL: #40928 (comment)
Tests
Reply in thread
of that messageOffline tests
QA Steps
Reply in thread
of that messagePR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
android-native-d.mp4
Android: mWeb Chrome
android-mweb_d.mp4
iOS: Native
ios-native_d.mp4
iOS: mWeb Safari
ios-msfari_d.mp4
MacOS: Chrome / Safari
macos-web-d.mp4
MacOS: Desktop
macos-desktop_d.mp4