-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Add support for inline code with space only characters #49038
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
Changes from 2 commits
3c7bfed
102455a
3c12da6
d05cfc7
6885f11
81c3fbc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -739,6 +739,18 @@ function getLastVisibleAction(reportID: string, actionsToMerge: Record<string, N | |
return sortedReportActions[0]; | ||
} | ||
|
||
function formatLastMessageText(lastMessageText: string) { | ||
const trimmedMessage = String(lastMessageText).trim(); | ||
|
||
// Add support for inline code containing only space characters | ||
// The message will appear as a blank space in the LHN | ||
if ((trimmedMessage === '' && lastMessageText.length > 0) || (trimmedMessage === '?\u2026' && lastMessageText.length > CONST.REPORT.MIN_LENGTH_LAST_MESSAGE_WITH_ELLIPSIS)) { | ||
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. Can you share what are contexts that the second condition would be used? 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. To test: try sending an inline code with many spaces inside it, for example:
The 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. Thanks for the explanation. |
||
return ' '; | ||
} | ||
|
||
return StringUtils.lineBreaksToSpaces(trimmedMessage).substring(0, CONST.REPORT.LAST_MESSAGE_TEXT_MAX_LENGTH).trim(); | ||
} | ||
|
||
function getLastVisibleMessage( | ||
reportID: string, | ||
actionsToMerge: Record<string, NullishDeep<ReportAction> | null> = {}, | ||
|
@@ -763,7 +775,7 @@ function getLastVisibleMessage( | |
|
||
let messageText = getReportActionMessageText(lastVisibleAction) ?? ''; | ||
if (messageText) { | ||
messageText = StringUtils.lineBreaksToSpaces(String(messageText)).substring(0, CONST.REPORT.LAST_MESSAGE_TEXT_MAX_LENGTH).trim(); | ||
messageText = formatLastMessageText(messageText); | ||
} | ||
return { | ||
lastMessageText: messageText, | ||
|
@@ -1667,6 +1679,7 @@ function getRemovedFromApprovalChainMessage(reportAction: OnyxEntry<ReportAction | |
export { | ||
doesReportHaveVisibleActions, | ||
extractLinksFromMessageHtml, | ||
formatLastMessageText, | ||
getActionableMentionWhisperMessage, | ||
getAllReportActions, | ||
getCombinedReportActions, | ||
|
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 double-check, are you available to check if there are no breaking changes when we bump from 2.0.84 to 2.0.88?
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 believe there are no breaking changes. However, I have noticed another issue that also wants updating the
expensify-common
package (to version 2.0.87): #46117. Should we wait for a PR to be raised for that issue? or should we proceed with this PR?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 think we should. @deetergp what do you think?
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've asked them in that PR if they want us to wait or not.