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

Show deleted comments in conversation history #6819

Merged
merged 9 commits into from
Jan 3, 2022

Conversation

aswin-s
Copy link
Contributor

@aswin-s aswin-s commented Dec 17, 2021

Details

This PR fixes an issue where deleted comments get removed completely from conversations. Instead it replaces deleted messages with a placeholder text [Comment deleted]

Fixed Issues

$ #6759

Tests

  1. Send a message in any conversation window.
  2. Delete the comment
  3. Verify that message gets replaced with placeholder text [Comment deleted]
  4. Repeat steps 2 & 3 for any previous messages.
  5. Try to delete attachments from web and verify that it gets replaced with placeholder text.

NB: Native apps doesn't seem to offer delete option at the moment. Reported here

QA Steps

  1. Send a message in any conversation window.
  2. Delete the comment
  3. Verify that message gets replaced with placeholder text [Comment deleted]
  4. Repeat steps 2 & 3 for any previous messages.
  5. Verify that status gets updated at receiving end as well

Tested On

  • Web
  • Mobile Web
  • Desktop
  • iOS
  • Android

Screenshots

Web

1.mp4

Mobile Web

Desktop

iOS

Android

2.mp4

@aswin-s aswin-s requested a review from a team as a code owner December 17, 2021 19:55
@MelvinBot MelvinBot requested review from Luke9389 and parasharrajat and removed request for a team December 17, 2021 19:55
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.

Does not look like the supporting color is applied at all? I think you should use styles instead of passing the color.

Comment on lines 94 to 97
isDeleted() {
// A deleted comment has either an empty array or an object with html field with empty string as value
return lodashGet(this.props.action, 'message[0].html', '') === '';
}
Copy link
Member

Choose a reason for hiding this comment

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

Move this to ReportUtils with isDeletedAction

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

*/
isDeleted() {
// A deleted comment has either an empty array or an object with html field with empty string as value
return lodashGet(this.props.action, 'message[0].html', '') === '';
Copy link
Member

Choose a reason for hiding this comment

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

Don't think we need to explicitly compare it with ===' '

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

/>
))}
{isDeleted
? <ExpensifyText color={themeColors.textSupporting}>{`[${Localize.translateLocal('common.deletedCommentMessage')}]`}</ExpensifyText>
Copy link
Member

Choose a reason for hiding this comment

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

use WithLocalize instead.

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

@aswin-s
Copy link
Contributor Author

aswin-s commented Dec 17, 2021

Does not look like the supporting color is applied at all? I think you should use styles instead of passing the color.

I took the video right before changing the text style. It was getting confusing with normal comments. Updated video below.

final.mp4

@parasharrajat
Copy link
Member

Thanks for the video. I am not a designer guy ✏️ so I will request @shawnborton to review the video and decide the color and font styles.

@parasharrajat
Copy link
Member

Which one look better?
image

@aswin-s
Copy link
Contributor Author

aswin-s commented Dec 17, 2021

Shouldn't format be the same as that used in LHN? @parasharrajat

@parasharrajat
Copy link
Member

yup, that's a valid point. Just thought of sharing a different perspective. But I definitely think that we should reduce the text size.

@shawnborton
Copy link
Contributor

I actually like what's shown in this comment here: #6819 (comment)

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.

a few changes...

@@ -200,8 +200,19 @@ function canShowReportRecipientLocalTime(personalDetails, myPersonalDetails, rep
&& moment().tz(currentUserTimezone.selected).utcOffset() !== moment().tz(reportRecipientTimezone.selected).utcOffset();
}

/**
* Check if the comment is deleted
* @param {Array<Object>} action
Copy link
Member

Choose a reason for hiding this comment

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

Wrong type...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@@ -42,4 +54,4 @@ ReportActionItemMessage.propTypes = propTypes;
ReportActionItemMessage.defaultProps = defaultProps;
ReportActionItemMessage.displayName = 'ReportActionItemMessage';

export default withNetwork()(ReportActionItemMessage);
export default compose(withNetwork(), withLocalize)(ReportActionItemMessage);
Copy link
Member

Choose a reason for hiding this comment

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

NAB: May be wrap this to the next lines like the other components?

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

/**
* Check if the comment is deleted
* @param {Array<Object>} action
* @returns {boolean}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* @returns {boolean}
* @returns {Boolean}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

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: @Luke9389

Copy link
Contributor

@Luke9389 Luke9389 left a comment

Choose a reason for hiding this comment

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

Lookin good! Thanks

@Luke9389 Luke9389 merged commit 19085f3 into Expensify:main Jan 3, 2022
@OSBotify
Copy link
Contributor

OSBotify commented Jan 4, 2022

🚀 Deployed to staging by @Luke9389 in version: 1.1.24-19 🚀

platform result
🤖 android 🤖 failure ❌
🖥 desktop 🖥 failure ❌
🍎 iOS 🍎 failure ❌
🕸 web 🕸 failure ❌

@francoisl
Copy link
Contributor

This failed because of the import ExpensifyText from '../../../components/ExpensifyText'; statement - looks like that component has been renamed or removed since the last commit. Can someone follow up with a fix PR please? Thanks!

@OSBotify
Copy link
Contributor

OSBotify commented Jan 4, 2022

🚀 Deployed to production by @francoisl in version: 1.1.24-19 🚀

platform result
🤖 android 🤖 failure ❌
🖥 desktop 🖥 failure ❌
🍎 iOS 🍎 failure ❌
🕸 web 🕸 failure ❌

@marcaaron marcaaron mentioned this pull request Jan 4, 2022
5 tasks
@marcaaron
Copy link
Contributor

@francoisl Fix here #7006

@marcaaron
Copy link
Contributor

Guessing this did not make it to staging and so does not need to be CP'd to staging but not sure just saw it was breaking my GH actions in open PRs I'm working on.

@Jag96
Copy link
Contributor

Jag96 commented Jan 4, 2022

The changes weren't deployed to staging, but the staging branch does have the broken code on it so I think we should CP so we can get this fixed on the production branch faster.

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.

8 participants