Skip to content
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] Room Header - UserStatusText to be displayed in Direct Chat #20593

Conversation

aditya-mitra
Copy link
Contributor

Proposed changes (including videos or screenshots)

In a 2-person direct message, the status of the other user could not be seen in the Header.
It has been fixed by fetching the other user's status-text in a 2-person direct message room.

updated.user-status-text.with.hook.mp4

Issue(s)

Closes #20197

Steps to test or reproduce

Same as mentioned in #20197

Further comments

This Pull Request introduces the same feature as in #20257 , but with lesser changes.
As Pull Request #20584 introduces the new useUserData hook it was possible to get the live user status text in a single file change.

const liveOtherUserStatusText = useUserData(otherUserQuery?.userId)?.statusText;

// if the other is offline, then liveOtherUserStatusText is undefined
const { value: data } = useEndpointData('users.info', otherUserQuery);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But for a user who is online, it would fetch the status twice. Perhaps we can put a check here, if liveOtherUserStatusText is undefined then pull from endpoint. Otherwise, getting status from enpoint is unnecessary.

Also I think useUserData() should provide userstatus in all cases, otherwise whats the benefit of using it? In that case we can always use endpoint.

@aditya-mitra aditya-mitra force-pushed the aditya-mitra-dm-status-text-hook branch from bfb3549 to 5549b2a Compare February 4, 2021 17:42
@dougfabris
Copy link
Member

dougfabris commented Feb 4, 2021

@aditya-mitra @yash-rajpal Guys, we really appreciate your efforts in helping us. But we cannot move forward with this PR because we were working that if a more complex approach that will advance a future job for us. Thank you so much! Btw this issue will be fixed in this PR: #20612

@dougfabris dougfabris closed this Feb 4, 2021
@aditya-mitra aditya-mitra deleted the aditya-mitra-dm-status-text-hook branch February 7, 2021 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

User's Custom Statuses no longer displayed in Direct Chat
3 participants