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

Add support for viewing group avatar photo #48757

Merged
merged 14 commits into from
Sep 17, 2024
Merged

Conversation

tsa321
Copy link
Contributor

@tsa321 tsa321 commented Sep 7, 2024

Details

Fixed Issues

$ #39850
PROPOSAL: #39850 (comment)

Tests

  1. Open a group report with a custom avatar.
  2. Click on the header to open the report details page.
  3. Click the avatar.
  4. Verify that the "View Photo" option is available, then click "View Photo."
  5. Ensure that the report avatar is displayed correctly.
  • Verify that no errors appear in the JS console

Offline tests

QA Steps

  1. Open a group report with a custom avatar.
  2. Click on the header to open the report details page.
  3. Click the avatar.
  4. Verify that the "View Photo" option is available, then click "View Photo."
  5. Ensure that the report avatar is displayed correctly.
  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
    • MacOS: Desktop
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that the left part of a conditional rendering a React component is a boolean and NOT a string, e.g. myBool && <MyComponent />.
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
      • If any non-english text was added/modified, I verified the translation was requested/reviewed in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native
android-native-d.mp4
Android: mWeb Chrome
android-mweb_d.mp4
iOS: Native
ios-native_d.mp4
iOS: mWeb Safari
ios-msfari_d.mp4
MacOS: Chrome / Safari
macos-web-d.mp4
macos-web-offline_d.mp4
MacOS: Desktop
macos-desktop_d.mp4

@tsa321 tsa321 requested a review from a team as a code owner September 7, 2024 07:05
@melvin-bot melvin-bot bot requested review from s77rt and removed request for a team September 7, 2024 07:05
Copy link

melvin-bot bot commented Sep 7, 2024

@s77rt Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@@ -842,8 +845,6 @@ function openReport(
if (avatar) {
parameters.file = avatar;
}

clearGroupChat();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am moving this to the NewChatConfirmPage because there is a glitch when completing the new chat group flow. The draft is removed even though the page is still displayed, causing an issue where the avatar and participants are removed.

bug video:
bug-d.mp4

Comment on lines 1038 to 1045
InteractionManager.runAfterInteractions(() => {
if (shouldDismissModal) {
Navigation.dismissModalWithReport(report);
} else {
Navigation.navigateWithSwitchPolicyID({route: ROUTES.HOME});
Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(report?.reportID ?? '-1'), actionType);
}
});
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am adding InteractionManager.runAfterInteractions because there is a bug when on new chat confirm page -> view photo of the avatar -> refresh the page -> going offline -> complete the new group chat flow, the report name changes to CONST.REPORT.DEFAULT_REPORT_NAME. This issue arises due to the following line:

reportName: ReportConnection.getAllReports()?.[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`]?.reportName ?? CONST.REPORT.DEFAULT_REPORT_NAME,

The problem occurs because openReport from the report screen is triggered before the new group report data is stored in Onyx.

Bug:
bug-d.mp4

Copy link
Contributor

Choose a reason for hiding this comment

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

Please see #48757 (comment).

Also is this related to the avatar or it's an existing bug?

@tsa321
Copy link
Contributor Author

tsa321 commented Sep 7, 2024

@s77rt There is a bug on Android where the avatar is not displayed when viewing a report avatar until the screen is tapped. This issue also occurs in the main when uploading a custom avatar to a workspace and then viewing the photo.

Bug:
bug-d.mp4

Comment on lines 53 to 60
const rootGroupReport = ReportUtils.getRootParentReport(report);
const source =
UserUtils.getFullSizeAvatar(report?.avatarUrl, 0) ??
UserUtils.getFullSizeAvatar(rootGroupReport?.avatarUrl, 0) ??
ReportUtils.getDefaultGroupAvatar(ReportUtils.getRootParentReport(report)?.reportID ?? '') ??
'';
return {
source,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

When opening a url of thread report the adding avatar in the end of url the current staging display:

Bug:
bug-d.mp4

So, I am using using the avatar of root of Group Chat for thread of group chat.

Copy link
Contributor

Choose a reason for hiding this comment

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

If the report is not a group we shouldn't use the group avatar

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What should we display for the thread in the group chat?

to test: in the thread of group chat add at the end. For example:

staging.new.expensify.com/r/1234567/avatar

Copy link
Contributor

Choose a reason for hiding this comment

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

Let's not work on this here. It's not directly related to group chat avatars

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok

Comment on lines 1038 to 1045
InteractionManager.runAfterInteractions(() => {
if (shouldDismissModal) {
Navigation.dismissModalWithReport(report);
} else {
Navigation.navigateWithSwitchPolicyID({route: ROUTES.HOME});
Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(report?.reportID ?? '-1'), actionType);
}
});
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are we adding the InteractionManager. here? We should wait for interaction only after we register them. Doing so without any registered handler is a workaround

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because of this bug:

I am adding InteractionManager.runAfterInteractions because there is a bug when on new chat confirm page -> view photo of the avatar -> refresh the page -> going offline -> complete the new group chat flow, the report name changes to CONST.REPORT.DEFAULT_REPORT_NAME. This issue arises due to the following line:

reportName: ReportConnection.getAllReports()?.[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`]?.reportName ?? CONST.REPORT.DEFAULT_REPORT_NAME,

The problem occurs because openReport from the report screen is triggered before the new group report data is stored in Onyx.

Bug:
bug-d.mp4

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we use dismissModal in onModalClose, we can revert this code.

Copy link
Contributor

Choose a reason for hiding this comment

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

Is this bug related to the new feature (group avatar view) or an existing bug?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It’s because we’re adding a new feature View photo in the NewChatConfirmPage.
The test step is:
On the new chat confirm page -> add avatar -> View photo of the avatar -> ReportAvatar will open -> refresh the page -> Go offline -> Close the report avatar -> complete the new group chat flow

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm still not sure what went wrong here.

The problem occurs because openReport from the report screen is triggered before the new group report data is stored in Onyx

Why this does not happen when we proceed with the flow normally? (without the avatar view feature)

Copy link
Contributor Author

@tsa321 tsa321 Sep 9, 2024

Choose a reason for hiding this comment

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

After merging main, it works now.
I am reverting this change.

@@ -694,6 +694,7 @@ function updateGroupChatAvatar(reportID: string, file?: File | CustomRNImageMani
key: `${ONYXKEYS.COLLECTION.REPORT}${reportID}`,
value: {
avatarUrl: file?.uri ?? '',
avatarFileName: file ? file?.name ?? '' : null,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
avatarFileName: file ? file?.name ?? '' : null,
avatarFileName: file?.name ?? '',

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we set avatarFileName to an empty string when file is undefined, the avatarFileName will remain an empty string. For example, when removing the avatar, the avatarFileName will stay as an empty string, but it should be set to null to effectively remove the avatarFileName.

To test this, go to the avatar picker’s popover menu and select "Remove Avatar." Then, check the Onyx value of avatarFileName. While the avatarUrl will be removed, the avatarFileName will remain an empty string.

Copy link
Contributor

Choose a reason for hiding this comment

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

While the avatarUrl will be removed, the avatarFileName will remain an empty string

How is that the url is being removed but the filename is not? given that both fallback to an empty string, or is it because the former is cleared from BE onyx response?

Either way, let's set both to null

const avatarURL = ReportUtils.getWorkspaceAvatar(report);
const policyName = ReportUtils.getPolicyName(report, true, policy);
const isPolicyRelatedReport = !!policyName;
const [shouldShowDefaultGroupAvatar, setShouldShowDefaultGroupAvatar] = useState(false);
Copy link
Contributor

Choose a reason for hiding this comment

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

We shouldn't use a state here. This info should be concluded from the draft data (avatarUri field)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To check whether the blob URI is available, I am using FileUtils.readFileAsync, which is an asynchronous operation. If an error is thrown, it means the blob URI isn't available. That is why we must use useState.
Is there any alternative? I am open to other solution.

Copy link
Contributor

@s77rt s77rt Sep 7, 2024

Choose a reason for hiding this comment

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

If it's not available clear the onyx value (the source of truth)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I understand now.

Comment on lines 85 to 90
if (isNewGroupDraftAvatar) {
Navigation.goBack();
Navigation.isNavigationReady().then(() => {
Navigation.navigate(ROUTES.NEW_CHAT_CONFIRM);
});
} else {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we just dismiss the modal?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When the user refreshes the ReportAvatar page on the NewChatConfirmPage, dismissModal will open the home/report screen instead of the NewChatConfirmPage. If the user starts a new chat again, the new group draft will be cleared. Should we dismiss the modal?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah I see. I think we should keep the user on the same page. But why we are doing this navigation that way? Why not Navigation.goBack(ROUTES.NEW_CHAT_CONFIRM)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I’ve tried it, but it still doesn’t work; the report screen opens instead.

Copy link
Contributor

Choose a reason for hiding this comment

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

Do you know why this happens?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It also happens in the main.
When the user opens the expense policy report -> goes to report details -> clicks on the workspace avatar -> the report/workspace avatar will be displayed -> Refresh the report avatar page -> close the report avatar modal -> notice that the home/report screen is displayed instead of the report details page (which is the parameter of the goBack).

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you please investigate the root cause of this one. And will passing shouldEnforceFallback=true fix the issue?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@s77rt It causes other bugs. This is a video from ReportDetail, but it will also reproduce in NewChatConfirmPage:

bug video:
bug-d.mp4

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can you please investigate the root cause of this one.

@s77rt I'm not sure; the ReportAvatar page might not be supported yet. There is no entry for the ReportAvatar screen in getAdaptedState.

I think need some modifications in getAdaptedState function

isWorkspaceAvatar
source={attachment.source}
onModalClose={onModalClose}
isWorkspaceAvatar={isPolicyRelatedReport && !isNewGroupDraftAvatar}
Copy link
Contributor

Choose a reason for hiding this comment

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

In which cases both can be true?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok

@@ -151,11 +163,12 @@ function NewChatConfirmPage({newGroupDraft, allPersonalDetails}: NewChatConfirmP
}}
size={CONST.AVATAR_SIZE.XLARGE}
avatarStyle={styles.avatarXLarge}
shouldDisableViewPhoto
shouldDisableViewPhoto={!avatarFile}
Copy link
Contributor

Choose a reason for hiding this comment

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

The shouldDisableViewPhoto prop should be removed and we should relay only on isUsingDefaultAvatar to disable the view photo option.

Comment on lines 124 to 126
newGroupDraft: {
key: ONYXKEYS.NEW_GROUP_CHAT_DRAFT,
},
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's use the hook instead useOnyx

@tsa321 tsa321 requested a review from s77rt September 10, 2024 03:41
@s77rt
Copy link
Contributor

s77rt commented Sep 10, 2024

@tsa321 I have been testing this and I keep seeing bugs related to the group draft avatar which is increasing the work complexity without adding significant value to the UX. For now let's remove that functionality for the group draft (the NewChatConfirmPage) and only add implement it for actual reports.

@tsa321
Copy link
Contributor Author

tsa321 commented Sep 11, 2024

@s77rt PR is ready for review

Signed-off-by: Tsaqif <[email protected]>
Comment on lines 32 to 56
const attachment = useMemo(() => {
if (isPolicyRelatedReport) {
return {
source: UserUtils.getFullSizeAvatar(ReportUtils.getWorkspaceAvatar(report), 0),
headerTitle: policyName,
originalFileName: policy?.originalFileName ?? policy?.id ?? report?.policyID ?? '',
isWorkspaceAvatar: true,
};
}

if (ReportUtils.isGroupChat(report) && !ReportUtils.isThread(report)) {
return {
source: report?.avatarUrl ? UserUtils.getFullSizeAvatar(report.avatarUrl, 0) : ReportUtils.getDefaultGroupAvatar(report?.reportID ?? ''),
headerTitle: ReportUtils.getReportName(report),
originalFileName: report?.avatarFileName ?? '',
isWorkspaceAvatar: false,
};
}

return {
source: UserUtils.getFullSizeAvatar(ReportUtils.getWorkspaceAvatar(report), 0),
headerTitle: unavailableWorkspace,
originalFileName: policy?.originalFileName ?? policy?.id ?? report?.policyID,
isWorkspaceAvatar: true,
};
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we have three cases? Can we change this to:

  1. If report is related to policy use the old logic
  2. Otherwise use report.avatarUrl

Signed-off-by: Tsaqif <[email protected]>
@tsa321
Copy link
Contributor Author

tsa321 commented Sep 11, 2024

@s77rt done

Copy link
Contributor

@s77rt s77rt left a comment

Choose a reason for hiding this comment

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

Getting close

Comment on lines 43 to 44
// eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps
}, [report, policy]);
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we still need to disable eslint here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

const attachment = useMemo(() => {
if (ReportUtils.isGroupChat(report) && !ReportUtils.isThread(report)) {
return {
source: report?.avatarUrl ? UserUtils.getFullSizeAvatar(report.avatarUrl, 0) : ReportUtils.getDefaultGroupAvatar(report?.reportID ?? ''),
Copy link
Contributor

Choose a reason for hiding this comment

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

report?.avatarUrl should be enough as you are nut supposed to be able to access this page if report does not have a custom avatar

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You can still access it using a URL, for example: dev.new.expensify.com:8082/r/12345678/avatar.

onModalClose={() => {
Navigation.goBack(ROUTES.REPORT_WITH_ID_DETAILS.getRoute(report?.reportID ?? '-1'));
}}
isWorkspaceAvatar
isWorkspaceAvatar={attachment.isWorkspaceAvatar}
maybeIcon
// In the case of default workspace avatar, originalFileName prop takes policyID as value to get the color of the avatar
Copy link
Contributor

Choose a reason for hiding this comment

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

Move this comment to where we set originalFileName for the workspace related reports

@@ -23,21 +23,38 @@ type ReportAvatarProps = ReportAvatarOnyxProps & StackScreenProps<AuthScreensPar
function ReportAvatar({report = {} as Report, route, policies, isLoadingApp = true}: ReportAvatarProps) {
Copy link
Contributor

Choose a reason for hiding this comment

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

While at it, can you please migrate the withOnyx props to use the hook instead useOnyx

Comment on lines 281 to 283
/** The filename of the avatar */
avatarFileName?: string;

Copy link
Contributor

Choose a reason for hiding this comment

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

NAB. Can you move this to be below avatarUrl

@tsa321
Copy link
Contributor Author

tsa321 commented Sep 16, 2024

@s77rt done

@tsa321 tsa321 requested a review from s77rt September 16, 2024 02:05
@s77rt
Copy link
Contributor

s77rt commented Sep 16, 2024

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified tests pass on all platforms & I tested again on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
    • MacOS: Desktop
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick).
    • I verified that the left part of a conditional rendering a React component is a boolean and NOT a string, e.g. myBool && <MyComponent />.
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Android: Native android
Android: mWeb Chrome mweb-chrome
iOS: Native ios
iOS: mWeb Safari mweb-safari
MacOS: Chrome / Safari web
MacOS: Desktop desktop

@s77rt
Copy link
Contributor

s77rt commented Sep 16, 2024

@tsa321 Please remove the outdated testing steps

@tsa321
Copy link
Contributor Author

tsa321 commented Sep 16, 2024

@s77rt I have updated the test steps.

@s77rt
Copy link
Contributor

s77rt commented Sep 16, 2024

Thank you!

@melvin-bot melvin-bot bot requested a review from marcaaron September 16, 2024 12:35
marcaaron
marcaaron previously approved these changes Sep 16, 2024
Copy link
Contributor

@marcaaron marcaaron left a comment

Choose a reason for hiding this comment

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

Changes LGTM, thanks! 🙇

@marcaaron
Copy link
Contributor

@tsa321 conflicts here if you can fix them then we are ready to merge. Thanks!

@tsa321
Copy link
Contributor Author

tsa321 commented Sep 16, 2024

@marcaaron I have resolved the conflict. The check errors are from main.

@tsa321 tsa321 requested a review from marcaaron September 16, 2024 23:50
@marcaaron
Copy link
Contributor

marcaaron commented Sep 17, 2024

I'd like to get a follow up going potentially to just review the necessary changes to fix the eslint warnings as they seem unrelated, potentially complex, and this one is ready to merge in it's current state.

There's more context on it here, but I am not sure if the refactoring effort needs to be combined into this PR. We might still ask you to do it. @roryabraham probably has more thoughts on this.

Edit: Gonna merge and left some reasoning here -> https://expensify.slack.com/archives/C01GTK53T8Q/p1726541893211989?thread_ts=1725905735.105989&cid=C01GTK53T8Q

@marcaaron marcaaron merged commit 539327d into Expensify:main Sep 17, 2024
16 of 17 checks passed
@melvin-bot melvin-bot bot added the Emergency label Sep 17, 2024
Copy link

melvin-bot bot commented Sep 17, 2024

@marcaaron looks like this was merged without a test passing. Please add a note explaining why this was done and remove the Emergency label if this is not an emergency.

@marcaaron
Copy link
Contributor

This was an eslint warning that we will fix in a follow up PR.

@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 https://github.com/marcaaron in version: 9.0.37-0 🚀

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

@OSBotify
Copy link
Contributor

🚀 Deployed to production by https://github.com/grgia in version: 9.0.38-4 🚀

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.

4 participants