Skip to content

[HOLD for payment 2022-05-20] [$500] Remove Send Money when no members in room - reported by @thesahindia #8357

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

Closed
mvtglobally opened this issue Mar 30, 2022 · 54 comments
Assignees
Labels
Engineering External Added to denote the issue can be worked on by a contributor Improvement Item broken or needs improvement. Weekly KSv2

Comments

@mvtglobally
Copy link

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Action Performed:

  1. Create a workspace
  2. Visit the Announce or Admins room of that policy ( it shouldn't have any other member except you )
  3. Tap on ➕ (on left side, near the composer)
  4. Select send money/request money

Expected Result:

It shouldn't show option to send money/ request money

Actual Result:

It's showing the option and user is able to go through the flow and get error in the end as the user is trying to request/send money to himself

Workaround:

unknown

Platform:

Where is this issue occurring?

  • Web
  • iOS
  • Android
  • Desktop App
  • Mobile Web

Version Number: 1.1.46-3
Reproducible in staging?: Y
Reproducible in production?: Y
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation

Screen.Recording.2022-03-17.at.1.21.26.AM.mov

Expensify/Expensify Issue URL:
Issue reported by: @thesahindia
Slack conversation: https://expensify.slack.com/archives/C01GTK53T8Q/p1647460332448239

View all open jobs on GitHub

@mvtglobally mvtglobally added AutoAssignerTriage Auto assign issues for triage to an available triage team member Daily KSv2 labels Mar 30, 2022
@melvin-bot
Copy link

melvin-bot bot commented Mar 30, 2022

Triggered auto assignment to @tjferriss (AutoAssignerTriage), see https://stackoverflow.com/c/expensify/questions/4749 for more details.

@melvin-bot melvin-bot bot removed the AutoAssignerTriage Auto assign issues for triage to an available triage team member label Mar 30, 2022
@tjferriss
Copy link
Contributor

I agree that we shouldn't error out when this happens, but perhaps instead of completely removing the option we keep it and direct people to invite someone to the room instead.

@tjferriss tjferriss removed their assignment Mar 30, 2022
@melvin-bot
Copy link

melvin-bot bot commented Mar 30, 2022

Triggered auto assignment to @danieldoglas (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.

@danieldoglas
Copy link
Contributor

Agreed with @tjferriss solution above.

@danieldoglas danieldoglas added Weekly KSv2 Improvement Item broken or needs improvement. External Added to denote the issue can be worked on by a contributor and removed Daily KSv2 labels Mar 31, 2022
@melvin-bot
Copy link

melvin-bot bot commented Mar 31, 2022

Triggered auto assignment to @Christinadobrzyn (External), see https://stackoverflow.com/c/expensify/questions/8582 for more details.

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Mar 31, 2022
@danieldoglas danieldoglas removed their assignment Mar 31, 2022
@Christinadobrzyn Christinadobrzyn changed the title When there is no other member in room (except you), you can see option to send/request money - reported by @thesahindia Remove Send Money when no members in room - reported by @thesahindia Apr 1, 2022
@Christinadobrzyn
Copy link
Contributor

@botify botify removed the Daily KSv2 label Apr 1, 2022
@MelvinBot MelvinBot added the Weekly KSv2 label Apr 1, 2022
@melvin-bot
Copy link

melvin-bot bot commented Apr 1, 2022

Triggered auto assignment to Contributor-plus team member for initial proposal review - @Santhosh-Sellavel (Exported)

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Apr 1, 2022
@melvin-bot
Copy link

melvin-bot bot commented Apr 1, 2022

Triggered auto assignment to @iwiznia (Exported), see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@allroundexperts
Copy link
Contributor

@iwiznia What about my proposal then?

@sobitneupane
Copy link
Contributor

@iwiznia What about my proposal then?

If I am allowed to comment on your proposal, it looks like you are proposing to show all the options if there are multiple participants which I guess is not the intended behavior.

@Santhosh-Sellavel
Copy link
Collaborator

@sobitneupane

I think we are intentionally showing only the split bill options in all the rooms. I am not sure, though.

No, It was accidentally showing because the report participant's value is wrong, which introduces this issue as well, fix should be the same for both.

cc: @iwiznia

@Santhosh-Sellavel
Copy link
Collaborator

Santhosh-Sellavel commented Apr 25, 2022

@iwiznia

Still looking for a better proposal.
As I said here proposals are similar & partial

@allroundexperts
Copy link
Contributor

@Santhosh-Sellavel The instructions are not clear. Can you specify what's missing in the above proposals?

@Santhosh-Sellavel
Copy link
Collaborator

Santhosh-Sellavel commented Apr 25, 2022

@allroundexperts

This is the expected outcome,

Show Send Money and Request Money Options if there is a participant other than the logged in User and Show Split Bill Option if there are more than one participants other than the logged in User. In this case, even rooms with a participant other than the logged-in user will have Send Money and Request Money options.

@sobitneupane Already commented what's wrong with your proposal here

@allroundexperts
Copy link
Contributor

allroundexperts commented Apr 25, 2022

@Santhosh-Sellavel Here's the updated proposal.

Proposal

First of all, we need to make sure that the hasMultipleParticipants variable has an accurate value. The reportParticipants variable contains the logged in user for admins and announce channels but ignores them for single or group channels.

The hasMultipleParticipants variable is thus removed and replaced with a new variable called reportParticipantsOtherThanLoggedInUser .

Suggested Change 1

const hasMultipleParticipants = reportParticipants.length > 1;

const reportParticipantsOtherThanLoggedInUser = _.filter(reportParticipants, email => this.props.myPersonalDetails.login !== email);

The condition which checks for the menu items to display is also changed such that if reportParticipantsOtherThanLoggedInUser.length === 1, we show the send and request money options. If reportParticipantsOtherThanLoggedInUser.length > 1, we show the splitBill option.

Suggested Change 2

menuItems={[
...(!hasExcludedIOUEmails
&& Permissions.canUseIOU(this.props.betas) ? [
hasMultipleParticipants
? {
icon: Expensicons.Receipt,
text: this.props.translate('iou.splitBill'),
onSelected: () => {
Navigation.navigate(
ROUTES.getIouSplitRoute(
this.props.reportID,
),
);
},
} : {
icon: Expensicons.MoneyCircle,
text: this.props.translate('iou.requestMoney'),
onSelected: () => {
Navigation.navigate(
ROUTES.getIouRequestRoute(
this.props.reportID,
),
);
},
},
] : []),
...(!hasExcludedIOUEmails && Permissions.canUseIOUSend(this.props.betas) && !hasMultipleParticipants ? [
{
icon: Expensicons.Send,
text: this.props.translate('iou.sendMoney'),
onSelected: () => {
Navigation.navigate(
ROUTES.getIOUSendRoute(
this.props.reportID,
),
);
},
},
] : []),

menuItems={[
                                                    ...(!hasExcludedIOUEmails
                                                        && Permissions.canUseIOU(this.props.betas)
                                                        && reportParticipantsOtherThanLoggedInUser.length === 1 ? [
                                                            {
                                                                icon: Expensicons.MoneyCircle,
                                                                text: this.props.translate('iou.requestMoney'),
                                                                onSelected: () => {
                                                                    Navigation.navigate(
                                                                        ROUTES.getIouRequestRoute(
                                                                            this.props.reportID,
                                                                        ),
                                                                    );
                                                                },
                                                            },
                                                            {
                                                                icon: Expensicons.Send,
                                                                text: this.props.translate('iou.sendMoney'),
                                                                onSelected: () => {
                                                                    Navigation.navigate(
                                                                        ROUTES.getIOUSendRoute(
                                                                            this.props.reportID,
                                                                        ),
                                                                    );
                                                                },
                                                            },
                                                        ] : []),
                                                    ...(!hasExcludedIOUEmails
                                                        && Permissions.canUseIOU(this.props.betas)
                                                        && reportParticipantsOtherThanLoggedInUser.length > 1 ? [
                                                            {
                                                                icon: Expensicons.Receipt,
                                                                text: this.props.translate('iou.splitBill'),
                                                                onSelected: () => {
                                                                    Navigation.navigate(
                                                                        ROUTES.getIouSplitRoute(
                                                                            this.props.reportID,
                                                                        ),
                                                                    );
                                                                },
                                                            },
                                                        ] : []),

Result

Screen.Recording.2022-04-25.at.11.02.38.PM.mov

@Santhosh-Sellavel
Copy link
Collaborator

@allroundexperts
Please try to include the exact code changes you are proposing instead of linking. Example like this #8357 (comment)

@Santhosh-Sellavel
Copy link
Collaborator

@allroundexperts
Kindly update your proposal accordingly so it would be easy to follow with explanations. Let me know after updating thanks!

@allroundexperts
Copy link
Contributor

@Santhosh-Sellavel Updated.

@Santhosh-Sellavel
Copy link
Collaborator

@iwiznia
Proposals are similar, so let's go with @sobitneupane here.
@sobitneupane Option 1 proposal here looks good to me.
One suggestion, let's move the IOU options preparation logic to a new method. Since the code is not DRY & too clumsy in Render Block.

🎀👀🎀 C+ reviewed.
Thanks!

@iwiznia
Copy link
Contributor

iwiznia commented Apr 28, 2022

Proposal looks good to me and I agree about the new method. @kadiealexander can you hire @sobitneupane please?

@Santhosh-Sellavel
Copy link
Collaborator

@sobitneupane Any update?

@Puneet-here
Copy link
Contributor

Hi the proposals above aren't complete if we only make the changes for actions we still be seeing our own contact whenever we try to send/reques/split bill as you can see in the screenshot.
Screenshot 2022-04-30 at 1 55 17 AM

As all the proposals are incomplete here's my proposal.

Proposal

We need to filter out our own login from the participant using _.filter

const participants = lodashGet(props, 'report.participants', []);

We will use two variables and based on them we will be showing different options, if showSplitBillOption is true will be showing the split bills and when showSendRequestMoney is true we will show the options of send and request money
( it is already proposed in the proposals above )

    const showSplitBillOption = _.filter(reportParticipants, email => this.props.myPersonalDetails.login !== email).length > 1;
    const showSendRequestMoney = _.filter(reportParticipants, email => this.props.myPersonalDetails.login !== email).length === 1;

We can create a new method showActions which will return an array of actions based on the conditions for different actions and we can just call it here

cc: @iwiznia @Santhosh-Sellavel

@sobitneupane sobitneupane mentioned this issue Apr 30, 2022
89 tasks
@Santhosh-Sellavel
Copy link
Collaborator

Santhosh-Sellavel commented Apr 30, 2022

@Puneet-here Your proposal has nothing new here, what are you trying to say.

Even your proposal is incomplete here.

if we only make the changes for actions we still be seeing our own contact whenever we try to send/reques/split bill as you can see in the screenshot.

I believe this would be handled in this PR, I see the accepted proposal has logic to solve the same!

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label May 2, 2022
@melvin-bot
Copy link

melvin-bot bot commented May 2, 2022

📣 @sobitneupane You have been assigned to this job by @kadiealexander!
Please apply to this job in Upwork and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

@kadiealexander
Copy link
Contributor

@sobitneupane please let me know once you've applied on Upwork!

@sobitneupane
Copy link
Contributor

@sobitneupane please let me know once you've applied on Upwork!

Applied.

@kadiealexander
Copy link
Contributor

Sent offers in Upwork to:
Hired contributor: @sobitneupane
C+: @Santhosh-Sellavel
Reporting bonus: @thesahindia

@melvin-bot melvin-bot bot added the Overdue label May 17, 2022
@kadiealexander
Copy link
Contributor

@sobitneupane could you please share an update here? Thanks!

@melvin-bot melvin-bot bot removed the Overdue label May 17, 2022
@Santhosh-Sellavel
Copy link
Collaborator

@kadiealexander PR is merged & it's on production now!

@kadiealexander kadiealexander changed the title [$500] Remove Send Money when no members in room - reported by @thesahindia [HOLD for payment 2022-05-20] [$500] Remove Send Money when no members in room - reported by @thesahindia May 18, 2022
@kadiealexander
Copy link
Contributor

Thanks @sobitneupane!!!

@kadiealexander
Copy link
Contributor

Everyone is paid! Thanks for your work, team.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Engineering External Added to denote the issue can be worked on by a contributor Improvement Item broken or needs improvement. Weekly KSv2
Projects
None yet
Development

No branches or pull requests