-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Show Room name in Desktop notification title if message is come from a chat room #19053
Changes from 2 commits
3e4762e
709b63d
dc63f9b
33e560c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -3,6 +3,7 @@ import _ from 'underscore'; | |||||||||
import focusApp from './focusApp'; | ||||||||||
import * as AppUpdate from '../../actions/AppUpdate'; | ||||||||||
import EXPENSIFY_ICON_URL from '../../../../assets/images/expensify-logo-round-clearspace.png'; | ||||||||||
import * as ReportUtils from '../../ReportUtils'; | ||||||||||
|
||||||||||
const DEFAULT_DELAY = 4000; | ||||||||||
|
||||||||||
|
@@ -92,20 +93,34 @@ export default { | |||||||||
* Create a report comment notification | ||||||||||
* | ||||||||||
* @param {Object} params | ||||||||||
* @param {Object} params.report | ||||||||||
* @param {Object} params.reportAction | ||||||||||
* @param {Function} params.onClick | ||||||||||
* @param {Boolean} usesIcon true if notification uses right circular icon | ||||||||||
*/ | ||||||||||
pushReportCommentNotification({reportAction, onClick}, usesIcon = false) { | ||||||||||
pushReportCommentNotification({report, reportAction, onClick}, usesIcon = false) { | ||||||||||
const {person, message} = reportAction; | ||||||||||
const plainTextPerson = _.map(person, (f) => f.text).join(); | ||||||||||
const isChatRoom = ReportUtils.isChatRoom(report); | ||||||||||
|
||||||||||
// Specifically target the comment part of the message | ||||||||||
const plainTextMessage = (_.find(message, (f) => f.type === 'COMMENT') || {}).text; | ||||||||||
|
||||||||||
let title = ''; | ||||||||||
let body = ''; | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
NAB. No need to set a init value here. |
||||||||||
|
||||||||||
if (isChatRoom) { | ||||||||||
const roomName = _.get(report, 'displayName', ''); | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this need to be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a regression from #21406 #21406 (comment). This should be changed to: const roomName = ReportUtils.getReportName(report); But if There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, great, thanks for the context. I will update it to use |
||||||||||
title = roomName; | ||||||||||
body = `${plainTextPerson}: ${plainTextMessage}`; | ||||||||||
} else { | ||||||||||
title = plainTextPerson; | ||||||||||
body = plainTextMessage; | ||||||||||
} | ||||||||||
|
||||||||||
push({ | ||||||||||
title: plainTextPerson, | ||||||||||
body: plainTextMessage, | ||||||||||
title, | ||||||||||
body, | ||||||||||
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. Can you move this line to look like this just for clarity
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.
Is it a good idea if I move them to top? Basically, intepreter usually move declaration to the top too.
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.
Yes looks good. but add an empty line after isChatRoom and before the comment.
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.
Just wanna clarify 1 more question. Do you think it too much empty line in this function? Or it looks good
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.
Looks good to me 😁
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 have updated PR with our discussion above. Could you help to review them again? Thanks