Autolink when edititng comments except wehn explicit link removal#13551
Conversation
|
@cead22 @eVoloshchak One of you needs to copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
|
The code looks good and works well, there are a couple of comments and stylistic issues that need to be addressed @markarmanus, as per this discussion, could you please add tests for all the cases you tested in the video? |
|
@eVoloshchak all comments addressed and extended the testing to include everything in the video. |
Thanks! |
|
Yes, please add unit tests for all the cases you tested manually 🙇 |
|
@cead22 @eVoloshchak Added unit tests. Also for some reason re requesting the review from @eVoloshchak removed @cead22. apologies for that. i dont seem to have premissions to add you again. |
|
@cead22 @eVoloshchak any updates ? |
|
Reviewing in a couple of hours |
|
@eVoloshchak @cead22 Sorry to be buggy, but i only have sometime to work on this today and i dont want to miss the 3 days bonus :D would really appreciate if you guys can find the time for it soon. Again apologies |
cead22
left a comment
There was a problem hiding this comment.
Sorry, but there's a few items left to polish this PR
|
@cead22 Done and no worries at all, thats the entire point of PR reviews. to make sure the code quality is up to snuff. You have a good eye. |
|
@markarmanus, there are a couple of issues left with the PR description
|
Reviewer Checklist
Screenshots/VideosWebScreen.Recording.2022-12-15.at.11.18.32.movNot able to test due to an issue with the back end, using a Desktop video instead Mobile Web - ChromeScreen.Recording.2022-12-15.at.11.18.32.movNot able to test due to an issue with the back end, using a Desktop video instead Mobile Web - SafariScreen.Recording.2022-12-15.at.11.18.32.movNot able to test due to an issue with the back end, using a Desktop video instead DesktopScreen.Recording.2022-12-15.at.11.18.32.moviOSScreen.Recording.2022-12-15.at.11.15.07.movAndroidScreen_Recording_20221215-112215_New.Expensify.mp4-- add screenshots or videos here --> |
|
@AndrewGable Also no need to apologize always open to improve the code. |
|
cc: @eVoloshchak @cead22 |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
Performance Comparison Report 📊Significant Changes To DurationThere are no entries Meaningless Changes To DurationShow entries
Show details
|
|
🚀 Deployed to production by @yuwenmemon in version: 1.2.42-2 🚀
|
|
This PR caused a regression here #16571.
In step 3, we need to trim the message again as that step undo the trim of step 1 |
| * @returns {Array} | ||
| */ | ||
| const extractLinksInMarkdownComment = (comment) => { | ||
| const regex = /\[[^[\]]*\]\(([^()]*)\)/gm; |
There was a problem hiding this comment.
Coming from #18911:
I understand it's difficult to find edge cases but this regex didn't handle such cases like [[test]](test.com)
There was a problem hiding this comment.
For consistency, we're now using markdown link regex exported from expensify-common.
|
|
||
| // Skip the Edit if message is not changed | ||
| if (originalMessageHTML === htmlForNewComment.trim()) { | ||
| if (parsedOriginalCommentHTML === htmlForNewComment.trim()) { |
There was a problem hiding this comment.
There was a case where resaving the edited message without changing the content will parse the link again #29225. Instead, it should not auto-link when it is removed explicitly and the content is not changed.
Details
The issue is when we edit a comment that has links we dont autolink them so that you can click on them. This is because we purposely removed autolnking in this PR #9090
The reason we removed it was when a user would delete the link from a comment it would re genrate it again.
The solution is this PR is to always generate a link unles a user explicitly removes it while editing. This requires comapring the original comment and after deleting comment, detecting which links if any the user removed explicitly and delete them.
Fixed Issues
$ #13221
$ #13221 (comment)
Tests
Same as QA
Offline tests
No specefic difference on offline. should behave exactly the same as online.
QA Steps
(e.g from `` to
hello)(e.g from
hellotohello www.google.com)(e.g
hello [www.google.com](https://www.google.com)to.hello [www.google.com](https://www.google.com) bye)(e.g from
hello [www.google.com](www.google.com) byetohello www.google.com bye)(e.g from
hello www.google.com byetohello www.google.com bye newText)(e.g from
hello [www.google.com](https://www.google.com) bye newTexttohello [www.google.com] newText bye)hello [www.google.com] newText bye(e.g from
hello [www.google.com] bye newTexttohello [www.google.com] bye newText facebook.com)(e.g from
helle [[www.google.com](https://www.google.com)] bye newText [facebook.com](https://www.facebook.com)tohelle [[www.google.com](https://www.google.com)] bye newText facebook.comNote: if the comment has the same link multiple times it could cause odd behaviour but its an edge case so should be okay.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodWaiting for Copylabel for a copy review on the original GH to get the correct copy.STYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)/** comment above it */thisproperly so there are no scoping issues (i.e. foronClick={this.submit}the methodthis.submitshould be bound tothisin the constructor)thisare necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);ifthis.submitis never passed to a component event handler likeonClick)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)Avataris modified, I verified thatAvataris working as expected in all cases)ScrollViewcomponent to make it scrollable when more elements are added to the page.off every checkbox in the PR author checklist, including those that don't apply to this PR.
Desktop,Android and IOS
Screen.Recording.2022-12-13.at.12.35.32.AM.mp4
Screenshots/Videos
Web
Screen.Recording.2022-12-15.at.2.45.01.PM.mp4
Mobile Web - Chrome
Screen.Recording.2022-12-15.at.4.06.17.PM.mov
Mobile Web - Safari
Screen.Recording.2022-12-15.at.4.10.13.PM.mov
Desktop
Please refer to video above with all Desktop, Android and IOS
iOS
Please refer to video above with all Desktop, Android and IOSAndroid
Please refer to video above with all Desktop, Android and IOS