Skip to content

Cut report last message to specified length#7124

Merged
Julesssss merged 4 commits into
Expensify:mainfrom
K4tsuki:last_message2
Jan 17, 2022
Merged

Cut report last message to specified length#7124
Julesssss merged 4 commits into
Expensify:mainfrom
K4tsuki:last_message2

Conversation

@K4tsuki

@K4tsuki K4tsuki commented Jan 11, 2022

Copy link
Copy Markdown
Contributor

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

@MelvinBot MelvinBot requested review from Julesssss and parasharrajat and removed request for a team January 11, 2022 07:08
Comment thread src/libs/actions/Report.js Outdated
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
Copy Markdown
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
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

Comment thread src/CONST.js Outdated
Comment thread src/libs/actions/Report.js Outdated
Comment on lines +614 to +616
// Alwasy cut last message
updatedReportObject.lastMessageText = cutLastMessage(messageText);

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

@parasharrajat parasharrajat Jan 11, 2022

Copy link
Copy Markdown
Member

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
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

K4tsuki and others added 2 commits January 11, 2022 15:47
Co-authored-by: Rajat Parashar <parasharrajat@users.noreply.github.com>

@parasharrajat parasharrajat left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Testing now...

Comment thread src/libs/reportUtils.js Outdated
Comment thread src/libs/reportUtils.js Outdated
Co-authored-by: Rajat Parashar <parasharrajat@users.noreply.github.com>

@parasharrajat parasharrajat left a comment

Copy link
Copy Markdown
Member

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

@Julesssss Julesssss left a comment

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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