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

[HOLD for payment 2023-04-10][Workspace Chats] Name of the workspace does not appear as the preview row in the search results for the admin #16463

Closed
6 tasks done
trjExpensify opened this issue Mar 23, 2023 · 26 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor

Comments

@trjExpensify
Copy link
Contributor

trjExpensify commented Mar 23, 2023

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Action Performed:

prerequisite: you must be using an account that's on the policyExpenseChat beta

  1. Go to new.expensify.com
  2. Click the green + icon FAB > New workspace
  3. Navigate to the Manager members tab of the workspace settings
  4. Click Invite and enter a valid email address to invite a new member to the workspace
  5. CMD+K to bring up the search/chat switcher page

Expected Result:

As an admin, the workspace chat in the search results should have the primaryLogin (or fullName) as the first row, and the name of the workspace as the second row. I.e

tom@trj.chat
Mills' Mills workspace 

Actual Result:

The workspace chat in the search results displays an empty preview from the member as the second row on creation. I.e

tom@trj.chat
tom@trj.chat: 

Workaround:

N/A beta feature

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • MacOS / Chrome / Safari
  • MacOS / Desktop

Version Number: v1.2.87-1
Reproducible in staging?:
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers): tom+wcrun20@trj.chat
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation

image

image (excuse the old mock)

Expensify/Expensify Issue URL:
Issue reported by: @trjExpensify
Slack conversation: https://expensify.slack.com/archives/C02HWMSMZEC/p1679607461290709?thread_ts=1679329747.036069&cid=C02HWMSMZEC

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~018cb101c0281722e5
  • Upwork Job ID: 1639025649633243136
  • Last Price Increase: 2023-03-28
@trjExpensify trjExpensify added Daily KSv2 Internal Requires API changes or must be handled by Expensify staff Bug Something is broken. Auto assigns a BugZero manager. labels Mar 23, 2023
@MelvinBot
Copy link

Current assignee @trjExpensify is eligible for the Bug assigner, not assigning anyone new.

@MelvinBot
Copy link

Job added to Upwork: https://www.upwork.com/jobs/~018cb101c0281722e5

@MelvinBot
Copy link

MelvinBot commented Mar 23, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

@MelvinBot
Copy link

Triggered auto assignment to Contributor Plus for review of internal employee PR - @0xmiroslav (Internal)

@BeeMargarida
Copy link
Contributor

Hi, Ana from Callstack, I can work on this issue

@BeeMargarida
Copy link
Contributor

Proposal

Please re-state the problem that we are trying to solve in this issue.

When searching for chats using Cmd+K, the preview of the Policy expense chats does not show the name of the workspace. The expected behaviour would be to show the name of the workspace for the admin and the last message for the member.

What is the root cause of that problem?

Currently there is no check to see if the user is the admin of the policy expense chat when building the chat preview for the search sidebar.

What changes do you think we should make in order to solve the problem?

The logic regarding the preview building for the search is in OptionsListUtils.js. Each report is iterated and the function createOption is called here with the prop forcePolicyNamePreview that controls if the chat preview shows the name of the policy workspace or the last message (if possible).

I suggest changing this part of the code to something like

const isOwner = ReportUtils.isPolicyExpenseChatAdmin(report, policies);

allReportOptions.push(createOption(logins, personalDetails, report, reportActions, {
    showChatPreviewLine,
    forcePolicyNamePreview: isPolicyExpenseChat ? isSearchingSomeonesPolicyExpenseChat || isOwner : forcePolicyNamePreview,
}));

The isPolicyExpenseChatAdmin is a new function that verifies if the current user is the admin of the policy and would be something like:

function isPolicyExpenseChatAdmin(report, policies) {
  if (!isPolicyExpenseChat(report)) {
      return false;
  }

  const policy = policies[`${ONYXKEYS.COLLECTION.POLICY}${report.policyID}`];
  if (!policy) {
      return false;
  }

  return policy ? policy.owner === currentUserEmail : false;
}

What alternative solutions did you explore? (Optional)

N/A

@melvin-bot melvin-bot bot removed the Overdue label Mar 27, 2023
@mountiny
Copy link
Contributor

mountiny commented Mar 27, 2023

policy.owner === currentUserEmail I am not sure if this condition is the best, at the moment you cannot invite more admins to the workspace in EChat, but you will be able to do this soon.

I think there is a role property for the policy, there is this method which checks if user is an admin for some policy

* Is the user an admin of a free policy (aka workspace)?
*
* @param {Array} policies
* @returns {Boolean}
*/
function isAdminOfFreePolicy(policies) {
return _.some(policies, policy => policy
&& policy.type === CONST.POLICY.TYPE.FREE
&& policy.role === CONST.POLICY.ROLE.ADMIN);
}
but we could check for a role in this specific poliicy I think

@BeeMargarida
Copy link
Contributor

policy.owner === currentUserEmail I am not sure if this condition is the best, at the moment you cannot invite more admins to the workspace in EChat, but you will be able to do this soon.

Ah, got it, makes sense

but we could check for a role in this specific policy I think

Ah, so does the role value adapt to the user? Didn't know that. So changing to the code below should work:

function isPolicyExpenseChatAdmin(report, policies) {
    if (!isPolicyExpenseChat(report)) {
        return false;
    }

    const policy = policies[`${ONYXKEYS.COLLECTION.POLICY}${report.policyID}`];
    if (!policy) {
        return false;
    }

    return policy.role === CONST.POLICY.ROLE.ADMIN;
}

I also noticed that the same error is happening to the LHN in the sidebar. This same logic could be applied there

@mountiny
Copy link
Contributor

@BeeMargarida Great, lets make a PR! Thank you!

@melvin-bot melvin-bot bot added the Reviewing Has a PR in review label Mar 27, 2023
@mountiny mountiny added External Added to denote the issue can be worked on by a contributor and removed Internal Requires API changes or must be handled by Expensify staff labels Mar 28, 2023
@melvin-bot melvin-bot bot changed the title [Workspace Chats] Name of the workspace does not appear as the preview row in the search results for the admin [$1000] [Workspace Chats] Name of the workspace does not appear as the preview row in the search results for the admin Mar 28, 2023
@MelvinBot
Copy link

Current assignee @trjExpensify is eligible for the External assigner, not assigning anyone new.

@mountiny
Copy link
Contributor

This is actually external so making it so

@MelvinBot
Copy link

Current assignee @0xmiroslav is eligible for the External assigner, not assigning anyone new.

@mountiny mountiny changed the title [$1000] [Workspace Chats] Name of the workspace does not appear as the preview row in the search results for the admin [Workspace Chats] Name of the workspace does not appear as the preview row in the search results for the admin Mar 28, 2023
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Mar 28, 2023
@MelvinBot
Copy link

Current assignee @mountiny is eligible for the External assigner, not assigning anyone new.

@mountiny mountiny removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Mar 28, 2023
@dangrous
Copy link
Contributor

oh hai just wanted to pop in here - will this be affected by #16483 which we're working on now?

@mountiny
Copy link
Contributor

Seems like we should be good, but would be great to probably merge yours and then merge main to our PR and confirm all works fine.

@BeeMargarida
Copy link
Contributor

Updated, merged main with the PR

@mountiny
Copy link
Contributor

Thanks, reviewed, just pending testing and review from C+

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Daily KSv2 labels Mar 31, 2023
@melvin-bot melvin-bot bot changed the title [Workspace Chats] Name of the workspace does not appear as the preview row in the search results for the admin [HOLD for payment 2023-04-07] [Workspace Chats] Name of the workspace does not appear as the preview row in the search results for the admin Mar 31, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Mar 31, 2023
@MelvinBot
Copy link

Reviewing label has been removed, please complete the "BugZero Checklist".

@MelvinBot
Copy link

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.2.92-2 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2023-04-07. 🎊

After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.

  • External issue reporter
  • Contributor that fixed the issue
  • Contributor+ that helped on the issue and/or PR

As a reminder, here are the bonuses/penalties that should be applied for any External issue:

  • Merged PR within 3 business days of assignment - 50% bonus
  • Merged PR more than 9 business days after assignment - 50% penalty

@MelvinBot
Copy link

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

  • [@0xmiroslav / @mountiny] The PR that introduced the bug has been identified. Link to the PR:
  • [@0xmiroslav / @mountiny] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
  • [@0xmiroslav / @mountiny] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
  • [@trjExpensify] Determine if we should create a regression test for this bug.
  • [@0xmiroslav] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
  • [@trjExpensify] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@melvin-bot melvin-bot bot added Weekly KSv2 and removed Weekly KSv2 labels Apr 3, 2023
@melvin-bot melvin-bot bot changed the title [HOLD for payment 2023-04-07] [Workspace Chats] Name of the workspace does not appear as the preview row in the search results for the admin [HOLD for payment 2023-04-10] [HOLD for payment 2023-04-07] [Workspace Chats] Name of the workspace does not appear as the preview row in the search results for the admin Apr 3, 2023
@MelvinBot
Copy link

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.2.93-4 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2023-04-10. 🎊

After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.

  • External issue reporter
  • Contributor that fixed the issue
  • Contributor+ that helped on the issue and/or PR

As a reminder, here are the bonuses/penalties that should be applied for any External issue:

  • Merged PR within 3 business days of assignment - 50% bonus
  • Merged PR more than 9 business days after assignment - 50% penalty

@MelvinBot
Copy link

MelvinBot commented Apr 3, 2023

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

  • [@0xmiroslav / @mountiny] The PR that introduced the bug has been identified. Link to the PR:
  • [@0xmiroslav / @mountiny] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
  • [@0xmiroslav / @mountiny] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
  • [@trjExpensify] Determine if we should create a regression test for this bug.
  • [@0xmiroslav] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
  • [@trjExpensify] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@mountiny mountiny changed the title [HOLD for payment 2023-04-10] [HOLD for payment 2023-04-07] [Workspace Chats] Name of the workspace does not appear as the preview row in the search results for the admin [HOLD for payment 2023-04-10][Workspace Chats] Name of the workspace does not appear as the preview row in the search results for the admin Apr 3, 2023
@melvin-bot melvin-bot bot added Daily KSv2 Overdue and removed Weekly KSv2 labels Apr 7, 2023
@MelvinBot
Copy link

@trjExpensify, @BeeMargarida, @mountiny, @0xmiroslav Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@MelvinBot
Copy link

@trjExpensify, @BeeMargarida, @mountiny, @0xmiroslav Whoops! This issue is 2 days overdue. Let's get this updated quick!

@trjExpensify
Copy link
Contributor Author

👋 Melv, I'm back from OoO today. @0xmiroslav, I've sent you a contract for the C+ review.

[@0xmiroslav / @mountiny] The PR that introduced the bug has been identified. Link to the PR:
[@0xmiroslav / @mountiny] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:

@BeeMargarida fixed the regression and was the author of #15895 which introduced it, so no action needed here! 😄 Checked them off.

As for these:

[@0xmiroslav / @mountiny] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
[@trjExpensify] Determine if we should create a regression test for this bug.
[@0xmiroslav] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
[@trjExpensify] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

We're in the process of adding the overarching workspace chats regression test suite, and this is covered in them, so no specific action is needed to add anything else. Checked them off!

@melvin-bot melvin-bot bot removed the Overdue label Apr 11, 2023
@trjExpensify
Copy link
Contributor Author

Settled up!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests

6 participants