Fix object mutation causes the WS item in search shows last message instead of WS name#54351
Conversation
|
@bernhardoj Can you please resolve the conflicts here? Also, please merge with the latest main as I am running into build issues due to another offending PR that was reverted. Will take this up for review today. Thanks. |
|
@rojiphil Done |
rojiphil
left a comment
There was a problem hiding this comment.
Thanks @bernhardoj for the PR. I also left some NAB comments. Please have a look.
Apart from that, I am not sure if the expected behaviour is to display the Workspace name all the time. When there is an available message in the report, displaying the last message text may be correct. And the workspace name can be displayed if there are no messages yet in the chat. Here is a test video comparing the staging and dev version. Let us confirm this though with the design team.
@Expensify/design What do you think?
54351-validate.mp4
| * Check if the report is the parent report of the currently viewed report or at least one child report has report action | ||
| */ | ||
| function shouldHideReport(report: OnyxEntry<Report>, currentReportId: string): boolean { | ||
| function shouldHideReport(report: OnyxEntry<Report>, currentReportId: string | undefined): boolean { |
There was a problem hiding this comment.
Can we do an early return here when currentReportId is undefined?
There was a problem hiding this comment.
I don't think we should do it because the logic depends on isChildReportHasComment. I would prefer to just let it go through the code since the parentReport will be undefined when currentReportID is undefined.
| * Checks if the current user is the admin of the policy. | ||
| */ | ||
| function isPolicyAdmin(policyID: string, policies: OnyxCollection<Policy>): boolean { | ||
| function isPolicyAdmin(policyID: string | undefined, policies: OnyxCollection<Policy>): boolean { |
There was a problem hiding this comment.
Also, same here. Can we do an early return here when policyID is undefined?
There was a problem hiding this comment.
I don't think it's necessary to add more code (3 lines) to this. If policyID is undefined, the policy object should be undefined too and the result will be false.
Interesting, I think this is my general understanding as well that if there is a message preview to be displayed on a chat row when searching for chats, we would display the preview message cc @Expensify/design @trjExpensify @JmillsExpensify for gut check too |
|
IIRC, we've always shown the workspace name as the second line in search
for the non-submitter participants where the title of the workspace chat is
the submitter's name. That's to distinguish between the DM and workspace
chat more easily.
*Tom Rhys Jones *
*Expensify*
…On Thu, 26 Dec 2024 at 19:17, Shawn Borton ***@***.***> wrote:
When there is an available message in the report, displaying the last
message text may be correct. And the workspace name can be displayed if
there are no messages yet in the chat.
Interesting, I think this is my general understanding as well that if
there is a message preview to be displayed on a chat row when searching for
chats, we would display the preview message cc @Expensify/design
<https://github.com/orgs/Expensify/teams/design> @trjExpensify
<https://github.com/trjExpensify> @JmillsExpensify
<https://github.com/JmillsExpensify> for gut check too
—
Reply to this email directly, view it on GitHub
<#54351 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AD3246MV3ITVXWWN6EYHGJ32HRI47AVCNFSM6AAAAABT4QOOZWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKNRTGA2DANJXHA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
|
I'm genuinely not sure what the expected behavior is. I can see how including |
|
Yeah I'm a bit torn as well, part of me thinks we should just treat these as consistently as possible and show them as they would show up in the LHN. |
|
Hm yeah, I'm a bit wary of it given that they would look identical apart from the avatar, which is pretty subtle. |
|
@rojiphil can we see a side-by-side comparison (just screenshot, no video) of showing |
@shawnborton Here is a screenshot of the same: |
|
Hmm I can't tell the difference between the two? |
@shawnborton I just updated the image with a rectangular boundary here. Hope this helps now. |
|
Ah interesting. Hmm, I still think we should just use whatever we use in the LHN. After all, this is the chat switcher, so I think it makes sense to show the list of chats exactly as it might appear in the LHN as well. |
|
I don't really understand what was circled in the above screenshot to illustrate the point, haha. The comparison I think we should be looking at is two results for:
How do you know which one is which when they both look like this in the results:
|
Hmm... That's an interesting point, but we also have the same problem in LHN although the icons differentiate the chats. Maybe we can add the workspace name within brackets along with |
|
We could do something like that as a follow up, but again, for now I think I would go for consistency and just reuse whatever we have in the LHN for what we display in the chat finder. |
|
Updated |
Reviewer Checklist
Screenshots/VideosMacOS: Chrome / Safari54351-web-safari-001.mp4MacOS: Desktop54351-desktop-001.mp4Android: Native54351-android-native-001.mp4Android: mWeb Chrome54351-mweb-chrome-001.mp4iOS: Native54351-ios-native-001.mp4iOS: mWeb Safari54351-mweb-safari-001.mp4 |
rojiphil
left a comment
There was a problem hiding this comment.
Thanks @bernhardoj for the update. Please also update the test steps to reflect the recent change.
@Beamanator The changes LGTM and works well too.
All yours for review.
Beamanator
left a comment
There was a problem hiding this comment.
LGTM! Love the cleanup along the way, thanks!
| } else if (ReportActionUtils.isPendingRemove(lastReportAction) && ReportActionUtils.isThreadParentMessage(lastReportAction, report?.reportID ?? '-1')) { | ||
| } else if (ReportActionUtils.isPendingRemove(lastReportAction) && report?.reportID && ReportActionUtils.isThreadParentMessage(lastReportAction, report.reportID)) { | ||
| lastMessageTextFromReport = Localize.translateLocal('parentReportAction.hiddenMessage'); | ||
| } else if (ReportUtils.isReportMessageAttachment({text: report?.lastMessageText ?? '-1', html: report?.lastMessageHtml, type: ''})) { |
There was a problem hiding this comment.
lol lastMessageText ?? -1 🤦
|
@rojiphil updated |
|
🚀 Deployed to staging by https://github.com/Beamanator in version: 9.0.83-0 🚀
|
|
🚀 Deployed to production by https://github.com/thienlnam in version: 9.0.83-5 🚀
|
1 similar comment
|
🚀 Deployed to production by https://github.com/thienlnam in version: 9.0.83-5 🚀
|


Explanation of Change
Fixed Issues
$ #53361
PROPOSAL: #53361 (comment)
Tests
Same as QA Steps
Offline tests
Same as QA Steps
QA Steps
Prerequisite:
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)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: mWeb Chrome
android.mweb.mp4
iOS: Native
iOS: mWeb Safari
ios.mweb.mp4
MacOS: Chrome / Safari
MacOS: Desktop
desktop.mp4