Skip to content

Separate report name and icon configuration from personal details#7367

Merged
tgolen merged 4 commits into
Expensify:mainfrom
sobitneupane:sn-bug_report_name_icon
Jan 25, 2022
Merged

Separate report name and icon configuration from personal details#7367
tgolen merged 4 commits into
Expensify:mainfrom
sobitneupane:sn-bug_report_name_icon

Conversation

@sobitneupane

@sobitneupane sobitneupane commented Jan 24, 2022

Copy link
Copy Markdown
Contributor

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 thread src/libs/actions/Report.js Outdated
Comment on lines +442 to +445
PersonalDetails.getFromReportParticipants(_.values(simplifiedReports));

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

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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 thread src/libs/actions/Report.js Outdated
Comment on lines +328 to +331
Onyx.connect({
key: ONYXKEYS.PERSONAL_DETAILS,
callback: (formattedPersonalDetails) => {
const reportsToUpdate = {};

Copy link
Copy Markdown
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?

@sobitneupane sobitneupane Jan 24, 2022

Copy link
Copy Markdown
Contributor Author

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
Copy Markdown
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
Copy Markdown
Member

Could you please also update the template?
image

Comment thread src/libs/actions/Report.js Outdated
Comment on lines +437 to +439
Promise.resolve(PersonalDetails.getFromReportParticipants(_.values(simplifiedReports))).then(
details => configureReportNameAndIcon(_.values(simplifiedReports), details),
);

Copy link
Copy Markdown
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));

@sobitneupane sobitneupane Jan 25, 2022

Copy link
Copy Markdown
Contributor Author

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?

@parasharrajat parasharrajat Jan 25, 2022

Copy link
Copy Markdown
Member

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

parasharrajat commented Jan 25, 2022

Copy link
Copy Markdown
Member

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

Please follow the template. It is necessary for automation.

Comment thread src/libs/actions/PersonalDetails.js Outdated

@parasharrajat parasharrajat left a comment

Copy link
Copy Markdown
Member

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor

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

@sobitneupane

sobitneupane commented Jan 27, 2022

Copy link
Copy Markdown
Contributor Author

@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
Copy Markdown
Member

Yeah, please create a new PR

@OSBotify

OSBotify commented Feb 1, 2022

Copy link
Copy Markdown
Contributor

🚀 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