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

[$250] Room - #announce room can be created via room mention #50173

Open
6 tasks done
IuliiaHerets opened this issue Oct 3, 2024 · 70 comments
Open
6 tasks done

[$250] Room - #announce room can be created via room mention #50173

IuliiaHerets opened this issue Oct 3, 2024 · 70 comments
Assignees
Labels
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

@IuliiaHerets
Copy link

IuliiaHerets commented Oct 3, 2024

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


Version Number: 9.0.44-0
Reproducible in staging?: Y
Reproducible in production?: Y
Email or phone of affected tester (no customers): [email protected]
Issue reported by: Applause Internal Team

Action Performed:

  1. Go to staging.new.expensify.com
  2. Create a new workspace.
  3. Go to FAB > Start chat > Room.
  4. Enter #announce as room name and save it.
  5. Note that it shows error that the room name cannot be #announce.
  6. Go to workspace chat.
  7. Send message containing #announce mention.
  8. Click Yes from the whisper to create the room.
  9. Note that #announce room can be created via mention.
  10. Invite 3 members to the workspace.
  11. Note that now there are two #announce rooms.

Expected Result:

In Step 8, app should prevent #announce room from being created via room mention.

Actual Result:

In Step 8. #announce room can be via room mention.
In Step 11, after inviting 3 members to the workspace, it results in two #announce rooms.

Workaround:

Unknown

Platforms:

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Bug6623434_1727973755589.20241004_003551.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021845791038434812550
  • Upwork Job ID: 1845791038434812550
  • Last Price Increase: 2024-10-28
  • Automatic offers:
    • allgandalf | Reviewer | 104651165
    • mkzie2 | Contributor | 104651168
Issue OwnerCurrent Issue Owner: @allgandalf
@IuliiaHerets IuliiaHerets added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Oct 3, 2024
Copy link

melvin-bot bot commented Oct 3, 2024

Triggered auto assignment to @sonialiap (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

@IuliiaHerets
Copy link
Author

@sonialiap FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors

@Nodebrute
Copy link
Contributor

Proposal

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

#announce room can be created via room mention

What is the root cause of that problem?

We are adding #announce in reserved names

App/src/CONST.ts

Line 1011 in 96aceca

RESERVED_ROOM_NAMES: ['#admins', '#announce'],

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

We can remove #announce from here

App/src/CONST.ts

Line 1011 in 96aceca

RESERVED_ROOM_NAMES: ['#admins', '#announce'],

We should also cleanup in other places where we are using #announce

What alternative solutions did you explore? (Optional)

@mkzie2
Copy link
Contributor

mkzie2 commented Oct 4, 2024

Edited by proposal-police: This proposal was edited at 2024-10-14 21:42:57 UTC.

Proposal

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

In Step 8. #announce room can be via room mention.
In Step 11, after inviting 3 members to the workspace, it results in two #announce rooms.

What is the root cause of that problem?

  • The policyAnnounce is just created if the policy has 3 or more members. This is handled in PR.

  • In this bug, when policyAnnounce is not created, then we send a message with room mention #announce, BE returns the actionable whisper, that is incorrect.

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

  • First, BE should not return actionable whisper message when user send #announce message.

  • Then, we need to modify the error message when creating a new room as well as when editing a room name. When user try creating a room with "announce" as name:

  1. If the policyAnnounce room has not been created yet, should show "This name is reserved for future use. Please choose a different name"

  2. If the policyAnnounce room has been, should show "A room with this name already exists" or "Announce is a default room on all workspaces. Please choose another name."

  • Below is the code changes:
  1. Introduce a function to check whether the policy has policyAnnounce or not:
function hasAnnounceRoom(reports: OnyxCollection<Report>, policyID: string): boolean {
    return Object.values(reports ?? {}).some((report) => report && report.policyID === policyID && isAnnounceRoom(report));
}
  1. Update the validation:

} else if (ValidationUtils.isReservedRoomName(values.roomName)) {

            } else if (values.roomName === '#announce') {
                if (!ValidationUtils.hasAnnounceRoom(reports, values.policyID ?? '-1')) {
                    ErrorUtils.addErrorMessage(errors, 'roomName', 'This name is reserved for future use. Please choose a different name');
                } else {
                    ErrorUtils.addErrorMessage(errors, 'roomName', translate('newRoomPage.roomAlreadyExistsError'));
                }
            } else if (ValidationUtils.isReservedRoomName(values.roomName)) {
  • The similar fix should be applied to:

} else if (ValidationUtils.isReservedRoomName(values.roomName)) {

What alternative solutions did you explore? (Optional)

  • First, BE should not return actionable whisper message when user send #announce message.

  • Then update the validation:

} else if (ValidationUtils.isReservedRoomName(values.roomName)) {

            } else if (values.roomName === '#announce') {
                ErrorUtils.addErrorMessage(errors, 'roomName', 'The name #announce is a default room title and cannot be used in a new name, please select a new name');
            } else if (ValidationUtils.isReservedRoomName(values.roomName)) {
  • The similar fix should be applied to:

} else if (ValidationUtils.isReservedRoomName(values.roomName)) {

@mkzie2
Copy link
Contributor

mkzie2 commented Oct 4, 2024

We only create a workspace when 3 or more participants are added. So, should we update the error message for creating a new room? When a user tries to create a room named 'announce,' my suggestion is:

  1. If the policyAnnounce room has not been created yet, should show "This name is reserved for future use. Please choose a different name" - This message informs the user that the room doesn't exist yet but could be created in the future.

  2. If the policyAnnounce room has been, should show "A room with this name already exists" or "Announce is a default room on all workspaces. Please choose another name." - This clarifies that the room is already created."

What do you think? @Expensify/design @sonialiap

@melvin-bot melvin-bot bot added the Overdue label Oct 7, 2024
@sonialiap
Copy link
Contributor

@IuliiaHerets can you please test this and confirm the URL of the new announce room you seem to be creating with the mention? I my test the mention links to the workspace announce room, so no new room is being created. I can't repo

Screen.Recording.2024-10-08.at.4.30.24.PM.mov

@melvin-bot melvin-bot bot removed the Overdue label Oct 8, 2024
@sonialiap sonialiap added the Needs Reproduction Reproducible steps needed label Oct 8, 2024
@MelvinBot
Copy link

This has been labelled "Needs Reproduction". Follow the steps here: https://stackoverflowteams.com/c/expensify/questions/16989

@IuliiaHerets
Copy link
Author

@sonialiap QA team can repro this issue. The link from both rooms are different. Also, there are two #announce in LHN

20241010_082743.mp4

@melvin-bot melvin-bot bot added the Overdue label Oct 10, 2024
Copy link

melvin-bot bot commented Oct 11, 2024

@sonialiap Whoops! This issue is 2 days overdue. Let's get this updated quick!

@sonialiap
Copy link
Contributor

Thanks for the replication and showing the URL for the confirmation. Does indeed look like we're duplicating chat rooms which is a bug

@melvin-bot melvin-bot bot removed the Overdue label Oct 14, 2024
@sonialiap sonialiap added External Added to denote the issue can be worked on by a contributor and removed Needs Reproduction Reproducible steps needed labels Oct 14, 2024
@melvin-bot melvin-bot bot changed the title Room - #announce room can be created via room mention [$250] Room - #announce room can be created via room mention Oct 14, 2024
Copy link

melvin-bot bot commented Oct 14, 2024

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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Oct 14, 2024
Copy link

melvin-bot bot commented Oct 14, 2024

Triggered auto assignment to Contributor-plus team member for initial proposal review - @allgandalf (External)

@sonialiap
Copy link
Contributor

@Expensify/design problem: users can create rooms with the name #announce. Two solution ideas:

one

#50173 (comment)

We only create a workspace when 3 or more participants are added. So, should we update the error message for creating a new room? When a user tries to create a room named 'announce,' my suggestion is:

  1. If the policyAnnounce room has not been created yet, show "This name is reserved for future use. Please choose a different name" - This message informs the user that the room doesn't exist yet but could be created in the future.
  2. If the policyAnnounce room has been, should show "A room with this name already exists" or "Announce is a default room on all workspaces. Please choose another name." - This clarifies that the room is already created.

two

Or do we want to have a single message that says something like, The name #announce is a default room title and cannot be used in a new name, please select a new name. regardless of whether #announce already exists or if it hasn't been created yet?

@allgandalf
Copy link
Contributor

was about to post that thanks @sonialiap 😄

@dannymcclain
Copy link
Contributor

Or do we want to have a single message that says something like, The name #announce is a default room title and cannot be used in a new name, please select a new name. regardless of whether #announce already exists or if it hasn't been created yet?

I think this idea is ok... But also, if the user wants an #announce room, I feel like we should just give it to them at that point. From a technical standpoint I'm not sure how this could work, but this situation is feeling a little silly to me:

User: "Hey I need an #announce room!"
Expensify: "Nope. Can't do it. That's a default workspace room."
User: "Ok. I want it. For my workspace."
Expensify: "Nope. We'll probably automatically create that room later when you have more members."
User: "...Ok. Can I have it now instead?"
Expensify: "Nope 🙃"

Curious what the rest of the @Expensify/design team thinks. But I guess what I'm wondering is if there's any way to just go ahead and actually create the announce room from the get go when a workspace is created (and hide it or something? Unless someone tries to find it?) or to just go ahead and create it if it hasn't been created yet.

@shawnborton
Copy link
Contributor

I think I am more in the camp of keeping #announce as a protected room name since we have some logic that determines if/when the announce room gets created depending on how many members your workspace has. So I basically agree with Sonia's two above.

@melvin-bot melvin-bot bot removed the Overdue label Nov 21, 2024
@yuwenmemon
Copy link
Contributor

@mkzie2 Can you please give it a spin?

@mkzie2
Copy link
Contributor

mkzie2 commented Nov 24, 2024

I tested the app after BE changes, and there is only one bug we need to fix from FE side: When we send the "#announce" message offline, it is highlighted until we are back online:

Screenshot 2024-11-24 at 16 17 58

Do you agree it is bug @yuwenmemon @allgandalf?

@melvin-bot melvin-bot bot added the Overdue label Nov 24, 2024
@allgandalf
Copy link
Contributor

@mkzie2 this sounds like FE issue to me and not BE

@melvin-bot melvin-bot bot removed the Overdue label Nov 25, 2024
@allgandalf
Copy link
Contributor

bump for comments @mkzie2

@mkzie2
Copy link
Contributor

mkzie2 commented Nov 27, 2024

Since this behavior occurs throughout the app and not just when sending #announce, I believe we need confirmation from the internal team on whether we should address the bug mentioned in this comment to ensure no effort is wasted. cc @yuwenmemon

Copy link

melvin-bot bot commented Dec 2, 2024

@yuwenmemon, @sonialiap, @allgandalf, @mkzie2 Eep! 4 days overdue now. Issues have feelings too...

@melvin-bot melvin-bot bot added the Overdue label Dec 2, 2024
@allgandalf
Copy link
Contributor

@yuwenmemon can you help here please

@melvin-bot melvin-bot bot removed the Overdue label Dec 2, 2024
Copy link

melvin-bot bot commented Dec 6, 2024

@yuwenmemon, @sonialiap, @allgandalf, @mkzie2 Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@melvin-bot melvin-bot bot added the Overdue label Dec 6, 2024
@allgandalf
Copy link
Contributor

friendly bump @yuwenmemon for review of this comment

@melvin-bot melvin-bot bot removed the Overdue label Dec 6, 2024
@yuwenmemon
Copy link
Contributor

Yep, that's a FE issue - let's fix it!

@yuwenmemon yuwenmemon added Help Wanted Apply this label when an issue is open to proposals by contributors and removed Help Wanted Apply this label when an issue is open to proposals by contributors labels Dec 6, 2024
@yuwenmemon
Copy link
Contributor

@mkzie2 do you want to tackle it?

Copy link

melvin-bot bot commented Dec 10, 2024

@yuwenmemon, @sonialiap, @allgandalf, @mkzie2 Whoops! This issue is 2 days overdue. Let's get this updated quick!

@melvin-bot melvin-bot bot added the Overdue label Dec 10, 2024
@mkzie2
Copy link
Contributor

mkzie2 commented Dec 11, 2024

To address the issue #50173 (comment), we should add exactlyMatch: true to:

const mentionReportContextValue = useMemo(() => ({currentReportID: report?.reportID ?? '-1'}), [report?.reportID]);

So it will be:

   const mentionReportContextValue = useMemo(() => ({currentReportID: report?.reportID ?? '-1', exactlyMatch: true}), [report?.reportID]);

What do you think @allgandalf ?

@yuwenmemon
Copy link
Contributor

Not overdue, the proposal just came in. What do you think @allgandalf?

Copy link

melvin-bot bot commented Dec 12, 2024

@yuwenmemon, @sonialiap, @allgandalf, @mkzie2 Huh... This is 4 days overdue. Who can take care of this?

@sonialiap
Copy link
Contributor

I'm OOO Dec 16-20, but I don't think this will need a BZ before I'm back so not adding a buddy

@allgandalf
Copy link
Contributor

@mkzie2 have you tested if this change affects the other room name whisper creation ?

@melvin-bot melvin-bot bot removed the Overdue label Dec 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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
Status: Bugs and Follow Up Issues
Development

No branches or pull requests

10 participants