App icon indicating copy to clipboard operation
App copied to clipboard

[HOLD for payment 2021-09-17] No error shown on Group Creation with Chronos

Open mananjadhav opened this issue 5 years ago • 37 comments

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. Click on FAB
  2. Click "New Group"
  3. Add Chronos as the member and click on Create Group
  4. No feedback/error message

Expected Result:

  1. Chronos shouldn't be visible in the Group list
  2. Or show an error when the server sends this 401 Chronos is not permitted to participate in group chats

Actual Result:

https://user-images.githubusercontent.com/3069065/128581813-a9112bc9-3360-4ed7-af85-630944398a5e.mp4

Workaround:

Don't choose Chronos while creating a new Group

Platform:

Where is this issue occurring?

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

Version Number: Logs: https://stackoverflow.com/c/expensify/questions/4856 Notes/Photos/Videos: Any additional supporting documentation Expensify/Expensify Issue URL:

View all open jobs on Upwork

mananjadhav avatar Aug 07 '21 00:08 mananjadhav

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

MelvinBot avatar Aug 07 '21 00:08 MelvinBot

Proposal

Don't show Chronos while adding to New Group

  1. getNewChatOptions defined in OptionsListUtils.js is being used to get participants in New group. It has a flag to ignoreConceirgeEmails and we can extend it to ignore Chronos email too. Because concerige is allowed in the group chat the config param would look like
function getNewChatOptions( reports, personalDetails, searchValue = '', excludeConcierge, excludeChronos, betas) {

or

function getNewChatOptions( reports, personalDetails, searchValue = '', { excludeConcierge: false, excludeChronos:true }, betas) {

  1. Accordingly update getOptions, where we can just add another flag, excludeChronos = false and add the following check

    if (excludeChronos) { loginOptionsToExclude.push({login: CONST.EMAIL.CHRONOS}); }

  2. Update references so that Chronos is not visible in the partiicpant search list.

API Error message

In addition to handling on the frontend, I feel we should also handle and show API error on the frontend.

At present there's no catch block and hence API errors are not caught.

In libs/actions/Report.js

fetchOrCreateChatReport(participants, shouldNavigate = true)

	...

	return API.CreateChatReport({

	}).then(() => {
		// Existing function
	}).catch(err => {
	let errorMessage = 
		switch(err.satatusCode) {
			mesage = .....
		}
		return throw new Error(translate(message))
	});
}

Then in NewGrouPage

	fetchOrCreateChatReport(...).then(...).catch(err => {
		Growl(err.message) // Error message to com here

	})

mananjadhav avatar Aug 07 '21 00:08 mananjadhav

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

MelvinBot avatar Aug 09 '21 13:08 MelvinBot

@AndrewGable Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

MelvinBot avatar Aug 12 '21 19:08 MelvinBot

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

MelvinBot avatar Aug 13 '21 16:08 MelvinBot

Thanks for the bug report @mananjadhav! @MitchExpensify or @deetergp any ideas on whether we should go with solution one or two? I think both proposals look good, let's just decide what we want to do in this case and then hire @mananjadhav

AndrewGable avatar Aug 13 '21 16:08 AndrewGable

I've added option 2 for Split Money. I would suggest let's use that so that it is generic across.

mananjadhav avatar Aug 13 '21 16:08 mananjadhav

Let's go with option 1, since it follows the precedent that excludeConcierge has already set.

deetergp avatar Aug 13 '21 19:08 deetergp

@deetergp We'll have other email addresses too in this section such as [email protected]? Internally if you see the getOptions function it takes an object only with flags. We'll end up adding parameters for all non-user accounts with Option 1. What do you think?

mananjadhav avatar Aug 13 '21 19:08 mananjadhav

Hmm, that's a fair point. We employ a number of service accounts like, receipts@, that could be problematic. I need to think on it a bit…

deetergp avatar Aug 16 '21 18:08 deetergp

Agreed and hence we've gone ahead with

function getNewChatOptions(
    reports,
    personalDetails,
    searchValue = '',
    excludeOptions,
    betas,
)

where

excludeOptions = {
	excludeConcierge,
	excludeChronos,
	excludeReceipts
}

mananjadhav avatar Aug 16 '21 18:08 mananjadhav

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

MelvinBot avatar Aug 16 '21 19:08 MelvinBot

Still discussing solution.

AndrewGable avatar Aug 16 '21 19:08 AndrewGable

Why would we ever need to pass excludeChronos: false? If we don't want to exclude something, we just shouldn't pass it.

How about this, rather than having a bunch of individual if (exclude…) {} checks, we pass an array of the logins we want to exclude

excludeLogins = [
	CONST.EMAIL.CONCIERGE,
	CONST.EMAIL.CHRONOS,
	etc…,
];

Then iterate over it in OptionsListUtils.js. Does that make sense?

deetergp avatar Aug 16 '21 19:08 deetergp

I had proposed a similar solution for one of the issues earlier but it seemed we weren't sure if we would have multiple automated accounts.

Tell me one thing, are we going to have all automated accounts disabled at all places except New Chat? If yes then a single flag, say excludeAutomatedAccounts will suffice, and then in the common function OptionsListUtils we can iterate.

If we're going to have different use-cases then the above solution works aptly.

mananjadhav avatar Aug 16 '21 19:08 mananjadhav

Tell me one thing, are we going to have all automated accounts disabled at all places except New Chat?

That is an interesting question! Concierge is currently a member of group chats in our old Expensify, in-app support tool, and I would assume that eventually it will be a part of group chats in NewDot. Conversely, Chronos has never been a group participant and there is nothing on the roadmap that would change that. Currently, there is no reason for anyone to chat with receipts@ in any context, but I could see allowing users to DM receipt attachments to it at some point.

The tl;dr is let's allow the ability to pass the individual accounts for now, rather than grouping all the automated accounts together.

deetergp avatar Aug 16 '21 21:08 deetergp

Thanks for the detailed answer. Yeah, then it makes sense to send individual accounts.

mananjadhav avatar Aug 16 '21 21:08 mananjadhav

@deetergp Are we good to take this ahead?

mananjadhav avatar Aug 18 '21 18:08 mananjadhav

Ultimately, it's @AndrewGable's call, but I'm all for moving forward with the proposal that includes individual accounts.

deetergp avatar Aug 19 '21 22:08 deetergp

Agreed! @MitchExpensify can you configure this via Upwork? Thanks.

AndrewGable avatar Aug 19 '21 22:08 AndrewGable