-
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
[HOLD for payment 2022-06-16] [$1000] Last message text in LHN includes text and no space above quoted text #8134
Comments
Triggered auto assignment to @alex-mechler ( |
This mostly looks good to me, but I don't know how much I agree with the Expected Result here. I think we would show the first line of the last message, as its a preview of the last message, so sending the last thing in that message does not make a ton of sense to me. Will mention in the slack thread. |
Updated the Ready to be handled externally |
Triggered auto assignment to @stephanieelliott ( |
Posted to Upwork: https://www.upwork.com/jobs/~017fecd4f1b010dc8e |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @parasharrajat ( |
Triggered auto assignment to @Luke9389 ( |
2x'd t0 $500: https://www.upwork.com/jobs/~017fecd4f1b010dc8e |
I need help on how I can generate quoted text. |
I have figured it out ! |
Proposal App/src/libs/actions/Report.js Line 1077 in 4d646e7
When converting text that contains html tags the tags are being replaced with no consideration for spacing. The solution would be to replace the tags with whitespace
Just ending here solves only one side of an issue. The issue is solved for the sender but not the recipient because this line : App/src/libs/actions/Report.js Line 1143 in 4d646e7
allows the recipient to receive text that has not been cleaned . So I suggest replacing it with : reportComment: cleanText,
Screen.Recording.2022-03-25.at.2.48.26.AM.mov |
Why does it only affect quotes? Did you manage to find it? The last time I checked other tags are safely separated with spaces so if you replace all tags with Do you have a better solution? Thanks. |
ProposalThere is some step we need to do to resolve this issue:
Creating a function to get the first line of the last message. In this function is we take an HTML message, we take the first line by splitting the line breaker. After that, we check if the first line text we get has a function getFirstLineOfLastMessageHTML(html) {
let textMessage = '';
const blockquoteRegExp = new RegExp(/<blockquote>(.*?)<\/blockquote>/g)
const allTagRegExp = new RegExp(/<[^>]*>?/gm)
const brTagRegExp = new RegExp(/<br[^>]*>/gi)
// Split the HTML by line breaker and then get the first item of it
const splittedComment = html.split(brTagRegExp);
const firstLineComment = _.first(splittedComment)
// Get the blockquote tag and the content if present,
// other than that use the first item from splitting
if (firstLineComment.match(blockquoteRegExp)) {
textMessage = _.first(firstLineComment.match(blockquoteRegExp));
} else {
textMessage = firstLineComment;
}
// Replace all tags present
return textMessage.replace(allTagRegExp, '');
} Next step is to change how App/src/libs/actions/Report.js Lines 1075 to 1077 in b347866
- const textForNewComment = isAttachment ? '[Attachment]'
- : htmlForNewComment.replace(/((<br[^>]*>)+)/gi, ' ').replace(/<[^>]*>?/gm, '');
+ const textForNewComment = isAttachment ? '[Attachment]' : ReportUtils.getFirstLineOfLastMessageHTML(htmlForNewComment); App/src/libs/actions/Report.js Lines 612 to 618 in b347866
if (newMaxSequenceNumber > initialLastReadSequenceNumber) {
const textForNewComment = ReportUtils.getFirstLineOfLastMessageHTML(messageText)
updatedReportObject.lastMessageTimestamp = reportAction.timestamp;
updatedReportObject.lastMessageText = ReportUtils.formatReportLastMessageText(textForNewComment);
updatedReportObject.lastActorEmail = reportAction.actorEmail;
} App/src/libs/actions/Report.js Lines 194 to 196 in b347866
- lastMessageText = lastActionMessage
- .replace(/((<br[^>]*>)+)/gi, ' ')
- .replace(/(<([^>]+)>)/gi, '');
+ lastMessageText = ReportUtils.getFirstLineOfLastMessageHTML(lastActionMessage); App/src/libs/actions/ReportActions.js Lines 104 to 112 in b347866
const messageText = lodashGet(reportActions, [reportID, lastMessageIndex, 'message', 0, 'html'], '');
const lastMessageText = ReportUtils.getFirstLineOfLastMessageHTML(messageText);
return ReportUtils.formatReportLastMessageText(lastMessageText); ScreenshotsSent new messageScreen.Recording.2022-03-26.at.20.04.33.movUpdate a messageScreen.Recording.2022-03-26.at.20.05.32.movDelete a messageScreen.Recording.2022-03-26.at.20.05.56.mov |
Thanks @parasharrajat for your feedback. Your feedback has helped me to come up with a better solution.
Please keep in mind that when a user is typing a quote, to switch to regular text a new line is introduced
|
AFAICT, this code block is responsible to remove the |
@parasharrajat here is my new proposal . Instead of removing the line below : Before The Changes Screen.Recording.2022-03-29.at.3.42.04.PM.movAter The Changes Screen.Recording.2022-03-29.at.3.41.02.PM.mov |
@parasharrajat just wants to make it clear. So I should create a new function inside ExpensifyMark.js to replace the LHN text right? .replace(/((<br[^>]*>)+)/gi, ' ')
.replace(/(<([^>]+)>)/gi, '')
.replace(/</blockquote>/gm, ' '); and then replace the logic above with calling the created function on Exp/App repo after exp-common is merged? |
Yup. Something like that. If you feel that we should not update the common repo. Then please confirm this on slack channel. |
PR raise for ExpensiMark |
PR is awaiting internal review |
Final PR may be on Hold for #8814 (comment) |
PR is on hold |
PR on HOLD |
Still on hold |
Still on hold pending PR from @Luke9389, see #8814 (comment) for context |
Thanks for the bump here. I forgot this was on me! |
The solution for this issue has been 🚀 deployed to production 🚀 in version 1.1.75-1 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue: If no regressions arise, payment will be issued on 2022-06-16. 🎊 |
@stephanieelliott bump 😃 |
All paid, thank you! |
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Action Performed:
Expected Result:
We should see the first line of the last message.
Actual Result:
We see both lines of the last message, with no space to fill the line break
Workaround:
unknown
Platform:
Where is this issue occurring?
Version Number: 1.1.41-3
Reproducible in staging?: Y
Reproducible in production?: Y
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation
Expensify/Expensify Issue URL:
Issue reported by: @twisterdotcom
Slack conversation: https://expensify.slack.com/archives/C01GTK53T8Q/p1646654742446119
View all open jobs on GitHub
The text was updated successfully, but these errors were encountered: