-
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
Prevent threads from being counted as DMs #37030
Conversation
@thesahindia 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] |
Hi, I'm looking for reviews so I will jump in here and review early. |
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 be careful about modifying a general function like this. We need to make sure that all uses of it make sense with the updated logic.
For example, this code could be broken if we exclude threads from being DMs.
I think we should replace some uses of this function to check if the top level parent report is a DM, and we should test related functionality.
@neil-marcellini I made sure that this was working with the other invocations of the function as well
In this code, it is expected that we should not include threads because we assume the user present only in 1:1 DM and not threads. So, in fact it would maybe fix a possible bug where the current user would be counted as a member of a thread without joining it. |
Reviewer Checklist
Screenshots/Videos |
I have tested it and approving in case we move forward without changing something. I am going OOO. |
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.
What about this code?
Lines 983 to 996 in 0d3f47b
/** | |
* Returns whether a given report can have tasks created in it. | |
* We only prevent the task option if it's a DM/group-DM and the other users are all special Expensify accounts | |
* | |
*/ | |
function canCreateTaskInReport(report: OnyxEntry<Report>): boolean { | |
const otherReportParticipants = report?.participantAccountIDs?.filter((accountID) => accountID !== currentUserAccountID) ?? []; | |
const areExpensifyAccountsOnlyOtherParticipants = otherReportParticipants?.length >= 1 && otherReportParticipants?.every((accountID) => CONST.EXPENSIFY_ACCOUNT_IDS.includes(accountID)); | |
if (areExpensifyAccountsOnlyOtherParticipants && isDM(report)) { | |
return false; | |
} | |
return true; | |
} |
It says that we should prevent creating a task in a DM / group if all other participants are Expensify accounts. Now that a thread within a DM is not considered a DM, users can create a task in a thread where all other participants are Expensify accounts.
That seems wrong.
Please check all uses of the function recursively and make sure they make sense. It would be helpful to write an explanation of that in the comment. Sorry to be so strict, but I don't want to break a bunch of stuff.
Really sorry for the delay! Had to take a break due to health reasons... Here is a comprehensive explanation for the change at all places:
So now here are the options we have:
|
Please let me know which option to move forward with as listed above. |
@esh-g thanks for checking all uses and adding explanation. It all looks good to me except Let's move forward with this and remove redundant checks for |
@neil-marcellini I delved deeper into the
Sorry once again for the communication lag, but I hope you get my point and please correct me if I'm wrong in my understanding somewhere |
That's an interesting case and I appreciate you considering it. I'll tag in @thienlnam since he worked on tasks a lot. Also let us know what you think @madmax330. I think that there is currently a bug on prod at step 4. It doesn't really make sense to me that you can't create a task in the parent DM chat, but you can in a thread. Maybe others see it differently though. With the current changes in this PR you wouldn't be allowed to create a task in a DM with concierge, but you could in a thread on that DM if concierge joined it. That's inconsistent. Let's aim for consistency. |
This check is only so that you can't create a task when it's just between you and one of our processing expensify email accounts. Likely your DMs with Concierge, Chronos, etc.
This generally won't happen - most of those accounts will not join any threads maybe with the exception of Concierge.
We've kind of moved forward with the notion that this isn't a bug because a child report can constitute of different members. Even if you can't invite someone to the DM between you and Concierge, you can create a thread, and invite members there and so we allow task creation there as well |
Alrighty, thanks for your perspective @thienlnam! After your explanation I think I'm happy with the current solution. I didn't know that you can invite members outside of a DM into a thread within that DM. It feels a little strange to me, but if that's how it works we should match that. |
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.
Looking good and I'm happy with what we have discussed so far. I feel like the following is a mistake. Please lmk if I'm wrong somewhere, but I feel pretty confident that this presents an issue.
@neil-marcellini Be sure to let me know if something else is left. I once checked all instances of |
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'm happy with it now thanks! All you @madmax330
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by https://github.com/madmax330 in version: 1.4.51-0 🚀
|
🚀 Deployed to production by https://github.com/luacmartins in version: 1.4.51-3 🚀
|
Details
Fixed Issues
$ #34651
PROPOSAL: #34651 (comment)
Tests
Offline tests
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 methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.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 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
Screen.Recording.2024-02-21.at.9.43.57.PM.mov
Android: mWeb Chrome
Screen.Recording.2024-02-21.at.9.34.52.PM.mov
iOS: Native
Screen.Recording.2024-02-21.at.9.52.33.PM.mov
iOS: mWeb Safari
Screen.Recording.2024-02-21.at.9.54.50.PM.mov
MacOS: Chrome / Safari
Screen.Recording.2024-02-21.at.9.25.59.PM.mov
MacOS: Desktop
Screen.Recording.2024-02-21.at.10.36.04.PM.mov