diff --git a/polygerrit-ui/app/behaviors/keyboard-shortcut-behavior/keyboard-shortcut-behavior.js b/polygerrit-ui/app/behaviors/keyboard-shortcut-behavior/keyboard-shortcut-behavior.js index 09e3b7264e..ca31ee80b0 100644 --- a/polygerrit-ui/app/behaviors/keyboard-shortcut-behavior/keyboard-shortcut-behavior.js +++ b/polygerrit-ui/app/behaviors/keyboard-shortcut-behavior/keyboard-shortcut-behavior.js @@ -171,6 +171,7 @@ const Shortcut = { TOGGLE_FILE_REVIEWED: 'TOGGLE_FILE_REVIEWED', TOGGLE_ALL_INLINE_DIFFS: 'TOGGLE_ALL_INLINE_DIFFS', TOGGLE_INLINE_DIFF: 'TOGGLE_INLINE_DIFF', + TOGGLE_HIDE_ALL_COMMENT_THREADS: 'TOGGLE_HIDE_ALL_COMMENT_THREADS', OPEN_FIRST_FILE: 'OPEN_FIRST_FILE', OPEN_LAST_FILE: 'OPEN_LAST_FILE', @@ -251,6 +252,8 @@ _describe(Shortcut.EXPAND_ALL_COMMENT_THREADS, ShortcutSection.DIFFS, 'Expand all comment threads'); _describe(Shortcut.COLLAPSE_ALL_COMMENT_THREADS, ShortcutSection.DIFFS, 'Collapse all comment threads'); +_describe(Shortcut.TOGGLE_HIDE_ALL_COMMENT_THREADS, ShortcutSection.DIFFS, + 'Hide/Display all comment threads'); _describe(Shortcut.LEFT_PANE, ShortcutSection.DIFFS, 'Select left pane'); _describe(Shortcut.RIGHT_PANE, ShortcutSection.DIFFS, 'Select right pane'); _describe(Shortcut.TOGGLE_LEFT_PANE, ShortcutSection.DIFFS, @@ -290,6 +293,8 @@ _describe(Shortcut.OPEN_FILE, ShortcutSection.FILE_LIST, 'Go to selected file'); _describe(Shortcut.TOGGLE_ALL_INLINE_DIFFS, ShortcutSection.FILE_LIST, 'Show/hide all inline diffs'); +_describe(Shortcut.TOGGLE_HIDE_ALL_COMMENT_THREADS, ShortcutSection.FILE_LIST, + 'Hide/Display all comment threads'); _describe(Shortcut.TOGGLE_INLINE_DIFF, ShortcutSection.FILE_LIST, 'Show/hide selected inline diff'); diff --git a/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list.js b/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list.js index 5e9825a2de..a0d4d42c0a 100644 --- a/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list.js +++ b/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list.js @@ -275,6 +275,8 @@ class GrFileList extends mixinBehaviors( [ [this.Shortcut.RIGHT_PANE]: '_handleRightPane', [this.Shortcut.TOGGLE_INLINE_DIFF]: '_handleToggleInlineDiff', [this.Shortcut.TOGGLE_ALL_INLINE_DIFFS]: '_handleToggleAllInlineDiffs', + [this.Shortcut.TOGGLE_HIDE_ALL_COMMENT_THREADS]: + '_handleToggleHideAllCommentThreads', [this.Shortcut.CURSOR_NEXT_FILE]: '_handleCursorNext', [this.Shortcut.CURSOR_PREV_FILE]: '_handleCursorPrev', [this.Shortcut.NEXT_LINE]: '_handleCursorNext', @@ -808,6 +810,15 @@ class GrFileList extends mixinBehaviors( [ this._toggleInlineDiffs(); } + _handleToggleHideAllCommentThreads(e) { + if (this.shouldSuppressKeyboardShortcut(e) || this.modifierPressed(e)) { + return; + } + + e.preventDefault(); + this.toggleClass('hideComments'); + } + _handleCursorNext(e) { if (this.shouldSuppressKeyboardShortcut(e) || this.modifierPressed(e)) { return; diff --git a/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list_html.js b/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list_html.js index 4ac4bb1416..df7cb00baf 100644 --- a/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list_html.js +++ b/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list_html.js @@ -310,6 +310,9 @@ export const htmlTemplate = html` display: none; } } + :host(.hideComments) { + --gr-comment-thread-display: none; + }