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

Separate report name and icon configuration from personal details #7367

Merged
merged 4 commits into from
Jan 25, 2022

Conversation

sobitneupane
Copy link
Contributor

@sobitneupane sobitneupane commented Jan 24, 2022

Details

Solve the issue of report names and icons.

Fixed Issues

$ #7261

Tests

  • Create New Room (Private) and check report name and icon
  • Create New Room (Restricted) and check report name and icon
  • Create New Group and check report name and icon
  • Create New Chat and check report name and icon

QA Steps

  • Create New Room (Private) and check report name and icon
  • Create New Room (Restricted) and check report name and icon
  • Create New Group and check report name and icon
  • Create New Chat and check report name and icon

Tested On

  • Web
  • Mobile Web
  • Desktop
  • iOS
  • Android

Screenshots

Web

Screenshot from 2022-01-24 10-14-52
Screenshot from 2022-01-24 10-13-23
Screenshot from 2022-01-24 10-01-59

Screenshot from 2022-01-24 09-53-28

Mobile Web

Screenshot_20220124-101849_Chrome

Desktop

iOS

Android

Screenshot_20220124-122600_New Expensify
Screenshot_20220124-122502_New Expensify

@sobitneupane sobitneupane requested a review from a team as a code owner January 24, 2022 07:38
@MelvinBot MelvinBot requested review from parasharrajat and tgolen and removed request for a team January 24, 2022 07:38
Comment on lines 442 to 445
PersonalDetails.getFromReportParticipants(_.values(simplifiedReports));

// Configure Report Name and Report Icon
configureReportNameAndIcon(_.values(simplifiedReports));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There could be race conditions here personal details may have not been stored in Onyx when this is called.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

            Promise.resolve(PersonalDetails.getFromReportParticipants(_.values(simplifiedReports))).then(
                details => configureReportNameAndIcon(_.values(simplifiedReports), details),
            );

@parasharrajat It will solve the issue. Any suggestion?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It won't be needed when PersonalDetails.getFromReportParticipants will return a promise.

Comment on lines 328 to 331
Onyx.connect({
key: ONYXKEYS.PERSONAL_DETAILS,
callback: (formattedPersonalDetails) => {
const reportsToUpdate = {};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where are you canceling the subscription?

Copy link
Contributor Author

@sobitneupane sobitneupane Jan 24, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't find anything about cancelling the subscription in the code as well as documentation.
Do you mean?

    Onyx.connect({
        key: ONYXKEYS.PERSONAL_DETAILS,
        callback: (formattedPersonalDetails) => {

+            if (!formattedPersonalDetails) {
+               return;
+          }

            const reportsToUpdate = {};

I am planing not to connect to onyx here. Instead use the returned value from PersonalDetails.getFromReportParticipants(_.values(simplifiedReports))

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that is a good idea.

Action methods should only have return values (data or a promise) if they are called by other actions. This is done to encourage that action methods can be called in parallel with no dependency on other methods (see discussion above).

@parasharrajat
Copy link
Member

Could you please also update the template?
image

Comment on lines 437 to 439
Promise.resolve(PersonalDetails.getFromReportParticipants(_.values(simplifiedReports))).then(
details => configureReportNameAndIcon(_.values(simplifiedReports), details),
);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Promise.resolve(PersonalDetails.getFromReportParticipants(_.values(simplifiedReports))).then(
details => configureReportNameAndIcon(_.values(simplifiedReports), details),
);
const simplifiedReportsList = _.values(simplifiedReports);
PersonalDetails.getFromReportParticipants(simplifiedReportsList)
.then(details => configureReportNameAndIcon(simplifiedReportsList, details));

Copy link
Contributor Author

@sobitneupane sobitneupane Jan 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case, we should also return promise in case particpantEmails.length === 0 from PersonalDetails.getFromReportParticipants()

  if (participantEmails.length === 0) {
      return Promise.resolve();
  }

@parasharrajat Any Suggestion?

Copy link
Member

@parasharrajat parasharrajat Jan 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that is fine. the interface should be consistent.

  if (participantEmails.length === 0) {
      return Promise.resolve([]); // if details is array then empty array.
  }

@parasharrajat
Copy link
Member

parasharrajat commented Jan 25, 2022

Still.... space needed between $ and url
image

Please follow the template. It is necessary for automation.

Copy link
Member

@parasharrajat parasharrajat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

cc: @tgolen

🎀 👀 🎀 C+ reviewed

@tgolen tgolen merged commit ecf7594 into Expensify:main Jan 25, 2022
@OSBotify
Copy link
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@OSBotify
Copy link
Contributor

🚀 Deployed to staging by @tgolen in version: 1.1.32-1 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

@johnmlee101
Copy link
Contributor

Heyo, this is causing #7417 so this will be reverted.

@sobitneupane
Copy link
Contributor Author

sobitneupane commented Jan 27, 2022

@parasharrajat I have updated the branch which should probably solve the issue. It solves the issue in my side. Could you please verify? Should I create a new PR?

@parasharrajat
Copy link
Member

Yeah, please create a new PR

@OSBotify
Copy link
Contributor

OSBotify commented Feb 1, 2022

🚀 Deployed to production by @roryabraham in version: 1.1.33-3 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants