-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Notifications for editing money requests #27299
Conversation
…nce-edit-notifications
…nce-edit-notifications
Alright this tests well with the given Web-E PR. However, push notifications are not working on iOS in dev atm so I cannot test there. |
Alright push notifications not working in dev is a known issue. Since this is controlled by the backend, verifying just Android should be safe since the logic is the same for both platforms. |
Backend changes are on staging so this is ready for review! @ntdiary please review and do the checklist. You do not have to test iOS for this. |
Reviewer Checklist
Screenshots/VideosWeb27299-web.mp4Mobile Web - ChromeN/AMobile Web - SafariN/ADesktop27299-desktop.mp4iOSN/A |
@@ -128,6 +128,16 @@ export default { | |||
}); | |||
}, | |||
|
|||
pushModifiedExpenseNotification({reportAction, onClick}, usesIcon = false) { | |||
push({ | |||
title: _.map(reportAction.person, (f) => f.text).join(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps there is only one person for now, so it's okay. If multiple people are supported in the future, it's better to separate the names with a symbol. : )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
join
adds a comma by default but we should add a space too. I'll update this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It works well on web/desktop/android, clicking notifications can also open the corresponding messages correctly. Haven't tested the display of special characters yet, but those are more like edge cases. 🙂
@arosiclair, it would be better if this comment about unit tests can be addressed. : ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code LGTM - mostly non-blocking comments for some minor improvements.
body: ReportUtils.getModifiedExpenseMessage(reportAction), | ||
delay: 0, | ||
onClick, | ||
icon: usesIcon ? EXPENSIFY_ICON_URL : '', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NAB, just sort of noticing that this module is formatted a bit differently than others in that it's missing JSDocs and the methods come after the export keyword.
@@ -1542,6 +1542,9 @@ function getProperSchemaForModifiedExpenseMessage(newValue, oldValue, valueName, | |||
/** | |||
* Get the report action message when expense has been modified. | |||
* | |||
* ModifiedExpense::getNewDotComment in Web-Expensify should match this. | |||
* If we change this function be sure to update the backend as well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NAB, this comment is well intentioned, but I wonder if we should take any additional steps besides this reminder.
Another thought, this kind of applies to basically any API call we have. Anytime the schema of the data passed to the frontend changes there is a risk of things breaking or being inconsistent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking the best next step is to actually get rid of this function and only format the message in Web-E. I can make a follow-up issue to address it.
@arosiclair will let you decide if you want to address @marcaaron's comments or merge |
@arosiclair unit test is failing? |
Yeah, I pointed it out here. |
Woops just fixed that. Ready for another review! @marcaaron |
Co-authored-by: Marc Glasser <marc.aaron.glasser@gmail.com>
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by https://github.com/arosiclair in version: 1.3.75-0 🚀
|
🚀 Deployed to production by https://github.com/mountiny in version: 1.3.75-12 🚀
|
🚀 Deployed to staging by https://github.com/arosiclair in version: 1.3.76-0 🚀
|
onClick: () => { | ||
// Navigate to this report onClick | ||
Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(reportID)); | ||
}, | ||
}); | ||
notifyNewAction(reportID, action.actorAccountID, action.reportActionID); | ||
const report = allReports[reportID]; | ||
|
||
const notificationParams = { | ||
report, | ||
reportAction, | ||
onClick: () => Navigation.navigate(ROUTES.getReportRoute(reportID)), | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This caused a regression #28328. We should have kept using ROUTES.REPORT_WITH_ID.getRoute
because ROUTES.getReportRoute
no longer exists.
(Seems like a merge conflict)
🚀 Deployed to production by https://github.com/mountiny in version: 1.3.76-6 🚀
|
if (!ReportActionsUtils.isNotifiableReportAction(action)) { | ||
Log.info(`${tag} No notification because this action type is not supported`, false, {actionName: action.actionName}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is causing some crashes:
Fatal Exception: com.facebook.react.common.JavascriptException: TypeError: Cannot read property 'actionName' of null, js engine: hermes, stack:
shouldShowReportActionNotification@1:3040125
shouldShowPushNotification@1:13695857
anonymous@1:13694964
anonymous@1:13688405
emit@1:162156
__callFunction@1:170848
anonymous@1:169200
__guard@1:170153
callFunctionReturnFlushedQueue@1:169158
If the action is not defined, we still proceed to the the block and we try to access the action.actionName which will cause crash
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
created a quick PR for this here #28880
Details
Adds support for displaying notifications for modified expense actions
Fixed Issues
$ https://github.com/Expensify/Expensify/issues/312244
Tests
Notifications not supported on mobile web
Offline tests
None
QA Steps
Same as Tests
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Web
Mobile Web - Chrome
N/A
Mobile Web - Safari
N/A
Desktop
iOS
Android