stable
Clone or download
story #29256 have a link to comment in context from overview This contribution allows user to go directly on a given comment from the timeline view when they click on the link in the comment's header. Please note that the way we scroll the comment widget into view is kind of tricky. Indeed, we have to call cm.scrollIntoView first to the target line number (the one having the widget), then refresh the editor, and scroll the widget into view afterwards. The whole process is wrapped in a setTimeout callback in order to let the comment being rendered. It was quite painful to make it work because codemirror only renders a subset of the file for performances reasons. If we have placeholders and comments in the file, we have to scroll a first time to the line, then refresh the editor, so the widgets have been rendered, then scroll the widget into view, again. Please also note that in some cases, the scroll is not precise enough, and the user might need to scroll a bit to see the comment. I do not have any alternative solution to propose, and this one seems to work 99% of the time, so I guess it is goodenough ¯\_(ツ)_/¯ How to test: - In the timeline view, click on the link in the header of an inline comment --> You are redirected to the file diff view on the given comment --> Same expectations for both diff modes Change-Id: I181602a5aab44e2d49c877afb1bd470519595f3b
Modified Files
Name | ||||
---|---|---|---|---|
M | plugins/pullrequest/scripts/pullrequests-app/src/app/code-collapse/collapsible-code-sections.test.ts | +2 | −2 | Go to diff View file |
M | plugins/pullrequest/scripts/pullrequests-app/src/app/comments/PullRequestCommentPresenter.ts | +1 | −0 | Go to diff View file |
A | plugins/pullrequest/scripts/pullrequests-app/src/app/file-diff/diff-modes/file-diff-comment-scroller.test.ts | +200 | −0 | Go to diff View file |
A | plugins/pullrequest/scripts/pullrequests-app/src/app/file-diff/diff-modes/file-diff-comment-scroller.ts | +138 | −0 | Go to diff View file |
A | plugins/pullrequest/scripts/pullrequests-app/src/app/file-diff/diff-modes/file-diff-comment-widgets-map.test.ts | +38 | −0 | Go to diff View file |
A | plugins/pullrequest/scripts/pullrequests-app/src/app/file-diff/diff-modes/file-diff-comment-widgets-map.ts | +38 | −0 | Go to diff View file |
M | plugins/pullrequest/scripts/pullrequests-app/src/app/file-diff/diff-modes/file-line-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-code-mirror-widget-creator.test.ts | +2 | −0 | Go to diff View file |
M | plugins/pullrequest/scripts/pullrequests-app/src/app/file-diff/diff-modes/side-by-side-code-mirror-widget-creator.ts | +4 | −0 | Go to diff View file |
M | plugins/pullrequest/scripts/pullrequests-app/src/app/file-diff/diff-modes/side-by-side-code-mirror-widgets-creation-manager.test.ts | +2 | −1 | Go to diff View file |
M | plugins/pullrequest/scripts/pullrequests-app/src/app/file-diff/diff-modes/side-by-side-code-mirrors-content-manager.test.ts | +4 | −4 | Go to diff View file |
M | plugins/pullrequest/scripts/pullrequests-app/src/app/file-diff/diff-modes/side-by-side-diff-component.js | +11 | −0 | Go to diff View file |
M | plugins/pullrequest/scripts/pullrequests-app/src/app/file-diff/diff-modes/side-by-side-line-grouper.test.ts | +5 | −5 | 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 | +1 | −1 | Go to diff View file |
M | plugins/pullrequest/scripts/pullrequests-app/src/app/file-diff/diff-modes/side-by-side-line-mapper.test.ts | +7 | −7 | Go to diff View file |
M | plugins/pullrequest/scripts/pullrequests-app/src/app/file-diff/diff-modes/side-by-side-lines-state.test.ts | +7 | −7 | Go to diff View file |
M | plugins/pullrequest/scripts/pullrequests-app/src/app/file-diff/diff-modes/unidiff-component.js | +12 | −0 | Go to diff View file |
M | plugins/pullrequest/scripts/pullrequests-app/src/app/file-diff/file-diff-component.js | +1 | −0 | Go to diff View file |
M | plugins/pullrequest/scripts/pullrequests-app/src/app/file-diff/file-diff-config.js | +7 | −1 | Go to diff View file |
M | plugins/pullrequest/scripts/pullrequests-app/src/app/file-diff/file-diff.tpl.html | +2 | −0 | Go to diff View file |
M | plugins/pullrequest/scripts/pullrequests-app/tests/stubs/FileDiffWidgetStub.ts | +6 | −1 | Go to diff View file |
M | plugins/pullrequest/scripts/pullrequests-app/tests/stubs/FileLineStub.ts | +8 | −7 | Go to diff View file |
M | plugins/pullrequest/scripts/pullrequests-app/tests/stubs/FileLinesStateStub.ts | +3 | −1 | Go to diff View file |