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

Cut report last message to specified length #7124

Merged
merged 4 commits into from
Jan 17, 2022

Conversation

K4tsuki
Copy link
Contributor

@K4tsuki K4tsuki commented Jan 11, 2022

Details

Cut last message of a report to specific length, because we only use last message as alternate text on RHN and LHN.

Fixed Issues

$ #6699

Tests

  1. Send large text message
  2. Open developer tools and search for alternateText showed in LHN and RHN on that room.
  3. Alternate text should contains trimmed last message and doesn't contain full length of last message
  4. Repeat steps above for sending IOU reques, receive new message and receive new IOU message.

QA Steps

  1. Send large text message
  2. Open developer tools and search for alternateText showed in LHN and RHN on that room.
  3. Alternate text should contains trimmed last message and doesn't contain full length of last message
  4. Repeat steps above for sending IOU reques, receive new message and receive new IOU message.

Tested On

  • Web
  • Mobile Web
  • Desktop
  • iOS
  • Android

Screenshots

Web

trim_3

trim_1

trim_2

Mobile Web

Desktop

iOS

Android

@K4tsuki K4tsuki requested a review from a team as a code owner January 11, 2022 07:08
@MelvinBot MelvinBot requested review from Julesssss and parasharrajat and removed request for a team January 11, 2022 07:08
Comment on lines 118 to 128
/**
* Used before merging Report data.
* Cut last message to specific length, because we don't need full last message
*
* @param {String} lastMessage
* @returns {String}
*/
function cutLastMessage(lastMessage) {
return lastMessage.substr(0, CONST.REPORT.MAX_LAST_MESSAGE_LENGTH);
}

Copy link
Member

Choose a reason for hiding this comment

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

Let's move this to reportUits as formatReportLastMessageText

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Comment on lines 614 to 616
// Alwasy cut last message
updatedReportObject.lastMessageText = cutLastMessage(messageText);

Copy link
Member

Choose a reason for hiding this comment

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

Why did you move this out of if block?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There might be a chance that this if block is not executed, so last message is not being cut.

Copy link
Member

Choose a reason for hiding this comment

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

Then it means that message is set somewhere else and we should cut the message there not 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.

I have add cuts to possible lastMessage, so this is not necessary. Let's remove this.

Copy link
Member

@parasharrajat parasharrajat Jan 11, 2022

Choose a reason for hiding this comment

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

I see that it is important here. We can't remove it. So we can just move the line back to the previous location and add the formatting.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Member

@parasharrajat parasharrajat left a comment

Choose a reason for hiding this comment

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

Testing now...

Copy link
Member

@parasharrajat parasharrajat left a comment

Choose a reason for hiding this comment

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

LGTM.

cc: @Julesssss
🎀 👀 🎀 C+ reviewed

Copy link
Contributor

@Julesssss Julesssss left a comment

Choose a reason for hiding this comment

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

Tests well for me

@Julesssss Julesssss merged commit c70bbaf into Expensify:main Jan 17, 2022
@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 @Julesssss in version: 1.1.30-4 🚀

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

@OSBotify
Copy link
Contributor

🚀 Deployed to production by @chiragsalian in version: 1.1.31-1 🚀

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