-
Notifications
You must be signed in to change notification settings - Fork 3k
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 object mutation causes the WS item in search shows last message instead of WS name #54351
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 |
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 @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
src/libs/ReportUtils.ts
Outdated
@@ -6386,7 +6386,7 @@ function isReportNotFound(report: OnyxEntry<Report>): boolean { | |||
/** | |||
* 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we do an early return here when currentReportId
is undefined?
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 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.
src/libs/ReportUtils.ts
Outdated
@@ -1631,7 +1631,7 @@ function isPolicyExpenseChatAdmin(report: OnyxEntry<Report>, policies: OnyxColle | |||
/** | |||
* 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, same here. Can we do an early return here when policyID
is undefined?
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 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 |
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 @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.
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! Love the cleanup along the way, thanks!
lastMessageTextFromReport = Localize.translateLocal('parentReportAction.hiddenMessage'); | ||
} else if (ReportUtils.isReportMessageAttachment({text: report?.lastMessageText ?? '-1', html: report?.lastMessageHtml, type: ''})) { |
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.
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 Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)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: mWeb Chrome
android.mweb.mp4
iOS: Native
iOS: mWeb Safari
ios.mweb.mp4
MacOS: Chrome / Safari
MacOS: Desktop
desktop.mp4