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.
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.
We need to include accountIdToName, don't we?
There was a problem hiding this comment.
@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 ?
| 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.
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>
luacmartins
left a comment
There was a problem hiding this comment.
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.
| const reportIdToName: Record<string, string> = {}; | |
| const reportIDToName: Record<string, string> = {}; |
There was a problem hiding this comment.
@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.
| const accountIdToName: Record<string, string> = {}; | |
| const accountIDToName: Record<string, string> = {}; |
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.
| 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
| let currentUserPrivateDomain: string | undefined; | ||
| let currentUserAccountID: number | undefined; | ||
| let isAnonymousUser = false; | ||
| const reportActionMessageCache: Record<string, string> = {}; |
There was a problem hiding this comment.
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.
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>
luacmartins
left a comment
There was a problem hiding this comment.
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 |
luacmartins
left a comment
There was a problem hiding this comment.
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... |
mollfpr
left a comment
There was a problem hiding this comment.
LGTM 👍
All yours @luacmartins
|
✋ 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 threadof that messageOffline tests
QA Steps
Reply in threadof that messagePR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.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