Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 leave option does not appear in group chat thread #40529
Fix leave option does not appear in group chat thread #40529
Changes from 11 commits
d7eedc7
f2adb93
10f3079
1ce4e9f
9e2db78
212dcf0
6f130b3
9baf84c
ccf3030
0a7e601
7299772
53323da
31ed70b
9b01946
f656e9c
c08fec1
5ed6873
403bd4a
c81ccf3
8346da5
8407f6d
535848c
03f51ea
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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 add a comment here like:
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.
Why do we check for
isChatReport
here and notisChatThread
?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.
Did you explore if
canLeaveRoom
can be left out here? On the face of it, it seems like it shouldn't be here 😄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 agree. Let's get rid of all the
canLeaveWhatever
logic and just clearly document all the reasons we can leave or join (even if we have to repeat some stuff). I think that will be much less confusing.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.
You're right, that is my mistake when I bring the logic from
HeaderView
into util.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.
In fact, we will only be able to join a chat if we can leave it. If we have left the room, then its notification is hidden, the join option will appear, and vice versa. That is the reason we have the
canLeave...
condition here.@jjcoffee @marcaaron What do you think if I update the
canJoinChat
like thisThere 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 would suggest renaming
canLeavePolicyExpenseChat
toisNonAdminOrOwnerOfPolicyExpenseChat()
.I also find this method a bit weird:
App/src/libs/ReportUtils.ts
Lines 5261 to 5278 in 9a727de
It has a default of
true
. But aren't there specific types of reports we can leave? We should check if it's one of them. Instead we are checking if it's NOT one of the rooms we "can't" leave.I bet once we figure out what those are then the logic is much simpler and we might not even need a
canLeaveRoom()
method at all.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 checked this function and agree
isNonAdminOrOwnerOfPolicyExpenseChat
is good, it's what we do in this function.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.
@marcaaron
canLeaveRoom
function just updated the case for invoice room, I think we can keep this logic as it is now. WDYT?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.
@marcaaron Here's the latest
canLeaveRoom
for context. I'm starting to wonder if it's better to open a separate issue to tidy up the overall logic here 😅That being said, the core issue here seems to be that 95% of
canLeaveRoom
is actually "is the room of a type that we can join or leave" with "is this a room we can leave" tacked on. Unless there are cases where you can leave a room, but not join again? (Unlikely, but maybe I've missed something!)Does it then make sense to clear things up a bit by creating a separate method,
canChangeRoomSubscription
or something, and then we just call that in bothcanLeaveRoom
andcanJoinRoom
(along withnotificationPreference
checks)? (Though I realise this is almost going back to what we had before withcanLeaveOrJoinRoom
😄)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'd love if we could stick with the current plan and do the tidying here. More bugs and confusion will arise from this if we don't make an effort to improve what we've got.
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.
Leave chat doesn't make sense for anonymous users since they haven't actually joined.
Issue: #43404