stable

Clone or download

Read-only

refactor: Migrate NewInlineCommentForm to Hybrids + TypeScript

part of request #29602 Migrate pullrequest file-diffs to TypeScript This is a first step in order to extract the most logic out of the side-by-side-diff-component and to be able to unit test this logic. The component depending too much on widgets creation, and, the new comment widget being written in angular.js, it is not possible yet to achieve that goal without extracting that part out of angular. [note] Regarding the workaround getLineNumberFromEvent, it appears that CodeMirror can provide the wrong line number. We now parse the textContent of the gutter element we can access from the provided event. How to test: No functional change expected. However, please verify the following points: - When a gutter is clicked (sbs and unified diffs), a NewInlineCommentForm is added to the line. - A placeholder has been created on the opposite line with the right height - When you cancel your comment, the widget is removed, and the opposite placeholder is removed (or its height is updated if it was there before) - When you submit, the widget is removed, and a PullRequestComment widget is added in place of the previous one. Change-Id: I06f68d053bb56c52a75f3e147952f4e372e15f93

Modified Files

Name
M plugins/pullrequest/scripts/pullrequests-app/src/app/app.js +1 −4 Go to diff View file
D plugins/pullrequest/scripts/pullrequests-app/src/app/autofocus-input-directive.js +0 −14 Go to diff View file
A plugins/pullrequest/scripts/pullrequests-app/src/app/file-diff/NewInlineCommentForm.test.ts +144 −0 Go to diff View file
A plugins/pullrequest/scripts/pullrequests-app/src/app/file-diff/NewInlineCommentForm.ts +139 −0 Go to diff View file
M plugins/pullrequest/scripts/pullrequests-app/src/app/file-diff/codemirror-helper-service.js +36 −57 Go to diff View file
M plugins/pullrequest/scripts/pullrequests-app/src/app/file-diff/diff-modes/side-by-side-diff-component.js +12 −36 Go to diff View file
M plugins/pullrequest/scripts/pullrequests-app/src/app/file-diff/diff-modes/side-by-side-line-height-equalizer.test.ts +4 −4 Go to diff View file
M plugins/pullrequest/scripts/pullrequests-app/src/app/file-diff/diff-modes/side-by-side-line-widgets-helper.test.ts +3 −3 Go to diff View file
M plugins/pullrequest/scripts/pullrequests-app/src/app/file-diff/diff-modes/side-by-side-line-widgets-helper.ts +1 −1 Go to diff View file
M plugins/pullrequest/scripts/pullrequests-app/src/app/file-diff/diff-modes/types.ts +2 −2 Go to diff View file
D plugins/pullrequest/scripts/pullrequests-app/src/app/file-diff/new-inline-comment-component.d.ts +0 −22 Go to diff View file
D plugins/pullrequest/scripts/pullrequests-app/src/app/file-diff/new-inline-comment-component.js +0 −56 Go to diff View file
D plugins/pullrequest/scripts/pullrequests-app/src/app/file-diff/new-inline-comment.html +0 −48 Go to diff View file
M plugins/pullrequest/scripts/pullrequests-app/src/app/gettext-catalog.ts +2 −0 Go to diff View file
M plugins/pullrequest/scripts/pullrequests-app/tests/stubs/FileDiffWidgetStub.ts +2 −2 Go to diff View file