-
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 inconsistent thread in group chat name on the details page and LHN #48046
Fix inconsistent thread in group chat name on the details page and LHN #48046
Conversation
@ahmedGaber93 Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
const reportName = ReportUtils.isDeprecatedGroupDM(report) || isGroupChat ? ReportUtils.getGroupChatName(undefined, false, report) : ReportUtils.getReportName(report); | ||
const reportName = ReportUtils.getReportName(report); |
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.
Do we need to remove isDeprecatedGroupDM
here? I see getReportName
doesn't have a clear condition for isDeprecatedGroupDM
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 don't know why we don't check for isDeprecatedGroupDM
in getReportName
, but the other usages of getReportName
doesn't check for isDeprecatedGroupDM
too.
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 think getReportName
may cover it by the default return, but I am not sure about that. Do we have any test steps can help us to confirm whether the issue is reproduced on deprecated group and confirm this PR fix?
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.
Yeah, I notice the default return too and it actually apply the limit by default.
Lines 3774 to 3781 in 8c69c58
// Not a room or PolicyExpenseChat, generate title from first 5 other participants | |
const participantsWithoutCurrentUser: number[] = []; | |
Object.keys(report?.participants ?? {}).forEach((accountID) => { | |
const accID = Number(accountID); | |
if (accID !== currentUserAccountID && participantsWithoutCurrentUser.length < 5) { | |
participantsWithoutCurrentUser.push(accID); | |
} | |
}); |
Do we have any test steps can help us to test this PR on deprecated group?
I don't think there is a way to create a deprecated group anymore. The only way to test it by opening the old existing deprecated group DM.
I have one here and using the logic from main
, the LHN title will show the participants with limit it to 5 participants, while the details page shows Chat Report as the name.
web.mp4
If we change it using this PR, the details title will show all the participants with a limit too.
web.mp4
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.
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 haven't investigated it yet, but I notice it happens too without this PR.
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 think we need to investigate it
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.
Fixed
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.
Thanks for the investigations, but that fix still not works fine in all places, let's keep it to fix separately here #47803. I just wanted to confirm it is not a regression from our PR
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've reverted the commit. Lmk if I misunderstood it.
src/libs/SidebarUtils.ts
Outdated
const displayNamesWithTooltips = ReportUtils.getDisplayNamesWithTooltips( | ||
(participantPersonalDetailList || []).slice(0, 10), | ||
(participantPersonalDetailList || []).slice(0, 5), |
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.
Can you explain how this can fix the inconsistent in name while the inconsistent is at the name beginning not at the end?
For example the current name is name3, name4, name5, name6, ...
. how .slice(0, 5)
can fix it to name1, name2, name3, name4, name5, ...
?
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.
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.
Note getDisplayNamesWithTooltips
use sort method but get getReportName
is not
Lines 2387 to 2396 in 0f26b8a
.sort((first, second) => { | |
// First sort by displayName/login | |
const displayNameLoginOrder = localeCompare(first.displayName, second.displayName); | |
if (displayNameLoginOrder !== 0) { | |
return displayNameLoginOrder; | |
} | |
// Then fallback on accountID as the final sorting criteria. | |
return first.accountID - second.accountID; | |
}); |
It looks LHN and header use getDisplayNamesWithTooltips
and details page use getReportName
, I just try edit getReportName
and the only title was changed is details title. So we may need different fix for deprecated group chat.
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.
Can you explain how this can fix the inconsistent in name while the inconsistent is at the name beginning not at the end?
Since getDisplayNamesWithTooltips
sorts the array by name, it's possible the account in index 5-9 has a "smaller" name.
Slicing it to 5 will make sure the account list will be the same between getDisplayNamesWithTooltips
and getReportName
.
Note getDisplayNamesWithTooltips use sort method but get getReportName is not
It looks LHN and header use getDisplayNamesWithTooltips and details page use getReportName
True, getDisplayNamesWithTooltips
is used in LHN and header so there is a tooltip for each account.
Should we sort in getReportName too? Or should we remove the sort from getDisplayNamesWithTooltips
?
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 think we should sort the both, but I prefer fixing it separately here #47803. I just wanted to confirm it is not a regression from our PR
This reverts commit 32f3257.
…eted-thread-in-group
Reviewer Checklist
Screenshots/VideosAndroid: Nativea.mp4Android: mWeb Chromeaw.mp4iOS: Nativei.mp4iOS: mWeb Safariiw.mp4MacOS: Chrome / Safariw.mp4MacOS: Desktopd.mp4 |
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. |
Details
On the details page and LHN, a deleted thread in a group chat doesn't show [Deleted message]. This PR fixes it.
Fixed Issues
$ #47564
PROPOSAL: #47564 (comment)
Tests
Same as QA Steps
Offline tests
Same as QA Steps
QA Steps
PR 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.mp4
Android: mWeb Chrome
android.mweb.mp4
iOS: Native
ios.mp4
iOS: mWeb Safari
ios.mweb.mp4
MacOS: Chrome / Safari
MacOS: Desktop