diff options
author | Oswaldo Ferreira <oswaldo@gitlab.com> | 2018-11-07 19:57:26 -0200 |
---|---|---|
committer | Oswaldo Ferreira <oswaldo@gitlab.com> | 2018-11-07 19:57:26 -0200 |
commit | 198402b38b59a43aa6e50259d7c13c0097dbdfac (patch) | |
tree | 972469d726a9fc38fa990ed6a5b29d9e91b409f6 /app/assets | |
parent | 8467167bbc7fb16e25b202c6eda37a9fe1f1a9d7 (diff) | |
download | gitlab-ce-osw-revert-comment-in-any-diff-line.tar.gz |
Revert "Merge branch 'osw-comment-on-any-line-on-diffs' into 'master'"osw-revert-comment-in-any-diff-line
This reverts commit a82a595728d54bdc12e51dfcfb22e9eddc449143, reversing
changes made to e7df959b8f99875edd246c7ac7779c3203e8755e.
Diffstat (limited to 'app/assets')
6 files changed, 30 insertions, 8 deletions
diff --git a/app/assets/javascripts/diffs/components/diff_line_gutter_content.vue b/app/assets/javascripts/diffs/components/diff_line_gutter_content.vue index e31a3546b69..f4a9be19496 100644 --- a/app/assets/javascripts/diffs/components/diff_line_gutter_content.vue +++ b/app/assets/javascripts/diffs/components/diff_line_gutter_content.vue @@ -55,6 +55,11 @@ export default { required: false, default: false, }, + isContextLine: { + type: Boolean, + required: false, + default: false, + }, isHover: { type: Boolean, required: false, @@ -76,6 +81,7 @@ export default { this.showCommentButton && this.isHover && !this.isMatchLine && + !this.isContextLine && !this.isMetaLine && !this.hasDiscussions ); diff --git a/app/assets/javascripts/diffs/components/diff_table_cell.vue b/app/assets/javascripts/diffs/components/diff_table_cell.vue index e26aa9c9b00..5d9a0b123fe 100644 --- a/app/assets/javascripts/diffs/components/diff_table_cell.vue +++ b/app/assets/javascripts/diffs/components/diff_table_cell.vue @@ -3,6 +3,7 @@ import { mapGetters } from 'vuex'; import DiffLineGutterContent from './diff_line_gutter_content.vue'; import { MATCH_LINE_TYPE, + CONTEXT_LINE_TYPE, EMPTY_CELL_TYPE, OLD_LINE_TYPE, OLD_NO_NEW_LINE_TYPE, @@ -70,6 +71,9 @@ export default { isMatchLine() { return this.line.type === MATCH_LINE_TYPE; }, + isContextLine() { + return this.line.type === CONTEXT_LINE_TYPE; + }, isMetaLine() { const { type } = this.line; @@ -84,7 +88,11 @@ export default { [type]: type, [LINE_UNFOLD_CLASS_NAME]: this.isMatchLine, [LINE_HOVER_CLASS_NAME]: - this.isLoggedIn && this.isHover && !this.isMatchLine && !this.isMetaLine, + this.isLoggedIn && + this.isHover && + !this.isMatchLine && + !this.isContextLine && + !this.isMetaLine, }; }, lineNumber() { diff --git a/app/assets/javascripts/diffs/components/inline_diff_table_row.vue b/app/assets/javascripts/diffs/components/inline_diff_table_row.vue index 44c05e4b634..542acd3d930 100644 --- a/app/assets/javascripts/diffs/components/inline_diff_table_row.vue +++ b/app/assets/javascripts/diffs/components/inline_diff_table_row.vue @@ -4,6 +4,8 @@ import DiffTableCell from './diff_table_cell.vue'; import { NEW_LINE_TYPE, OLD_LINE_TYPE, + CONTEXT_LINE_TYPE, + CONTEXT_LINE_CLASS_NAME, PARALLEL_DIFF_VIEW_TYPE, LINE_POSITION_LEFT, LINE_POSITION_RIGHT, @@ -39,9 +41,13 @@ export default { }, computed: { ...mapGetters('diffs', ['isInlineView']), + isContextLine() { + return this.line.type === CONTEXT_LINE_TYPE; + }, classNameMap() { return { [this.line.type]: this.line.type, + [CONTEXT_LINE_CLASS_NAME]: this.isContextLine, [PARALLEL_DIFF_VIEW_TYPE]: this.isParallelView, }; }, diff --git a/app/assets/javascripts/diffs/components/parallel_diff_table_row.vue b/app/assets/javascripts/diffs/components/parallel_diff_table_row.vue index 39312cddfce..fcc3b3e9117 100644 --- a/app/assets/javascripts/diffs/components/parallel_diff_table_row.vue +++ b/app/assets/javascripts/diffs/components/parallel_diff_table_row.vue @@ -5,6 +5,8 @@ import DiffTableCell from './diff_table_cell.vue'; import { NEW_LINE_TYPE, OLD_LINE_TYPE, + CONTEXT_LINE_TYPE, + CONTEXT_LINE_CLASS_NAME, OLD_NO_NEW_LINE_TYPE, PARALLEL_DIFF_VIEW_TYPE, NEW_NO_NEW_LINE_TYPE, @@ -41,8 +43,12 @@ export default { }; }, computed: { + isContextLine() { + return this.line.left && this.line.left.type === CONTEXT_LINE_TYPE; + }, classNameMap() { return { + [CONTEXT_LINE_CLASS_NAME]: this.isContextLine, [PARALLEL_DIFF_VIEW_TYPE]: true, }; }, diff --git a/app/assets/javascripts/diffs/constants.js b/app/assets/javascripts/diffs/constants.js index f5f5c0ffc29..78a39baa4cb 100644 --- a/app/assets/javascripts/diffs/constants.js +++ b/app/assets/javascripts/diffs/constants.js @@ -3,6 +3,7 @@ export const PARALLEL_DIFF_VIEW_TYPE = 'parallel'; export const MATCH_LINE_TYPE = 'match'; export const OLD_NO_NEW_LINE_TYPE = 'old-nonewline'; export const NEW_NO_NEW_LINE_TYPE = 'new-nonewline'; +export const CONTEXT_LINE_TYPE = 'context'; export const EMPTY_CELL_TYPE = 'empty-cell'; export const COMMENT_FORM_TYPE = 'commentForm'; export const DIFF_NOTE_TYPE = 'DiffNote'; @@ -21,6 +22,7 @@ export const LINE_SIDE_RIGHT = 'right-side'; export const DIFF_VIEW_COOKIE_NAME = 'diff_view'; export const LINE_HOVER_CLASS_NAME = 'is-over'; export const LINE_UNFOLD_CLASS_NAME = 'unfold js-unfold'; +export const CONTEXT_LINE_CLASS_NAME = 'diff-expanded'; export const UNFOLD_COUNT = 20; export const COUNT_OF_AVATARS_IN_GUTTER = 3; diff --git a/app/assets/javascripts/diffs/store/mutations.js b/app/assets/javascripts/diffs/store/mutations.js index e651c197968..a7eea2c1449 100644 --- a/app/assets/javascripts/diffs/store/mutations.js +++ b/app/assets/javascripts/diffs/store/mutations.js @@ -65,13 +65,7 @@ export default { const { highlightedDiffLines, parallelDiffLines } = diffFile; removeMatchLine(diffFile, lineNumbers, bottom); - - const lines = addLineReferences(contextLines, lineNumbers, bottom).map(line => ({ - ...line, - lineCode: line.lineCode || `${fileHash}_${line.oldLine}_${line.newLine}`, - discussions: line.discussions || [], - })); - + const lines = addLineReferences(contextLines, lineNumbers, bottom); addContextLines({ inlineLines: highlightedDiffLines, parallelLines: parallelDiffLines, |