Merge "Inline the single call of java_library2"
diff --git a/java/com/google/gerrit/server/PublishCommentsOp.java b/java/com/google/gerrit/server/PublishCommentsOp.java
index 6e0f3d9..df57629 100644
--- a/java/com/google/gerrit/server/PublishCommentsOp.java
+++ b/java/com/google/gerrit/server/PublishCommentsOp.java
@@ -15,7 +15,6 @@
 package com.google.gerrit.server;
 
 import com.google.common.collect.ImmutableMap;
-import com.google.common.flogger.FluentLogger;
 import com.google.gerrit.entities.ChangeMessage;
 import com.google.gerrit.entities.Comment;
 import com.google.gerrit.entities.PatchSet;
@@ -46,8 +45,6 @@
  * necessary event for this.
  */
 public class PublishCommentsOp implements BatchUpdateOp {
-  private static final FluentLogger logger = FluentLogger.forEnclosingClass();
-
   private final PatchSetUtil psUtil;
   private final ChangeNotes.Factory changeNotesFactory;
   private final ChangeMessagesUtil cmUtil;
diff --git a/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.html b/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.html
index 02b017b..623e8d1 100644
--- a/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.html
+++ b/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.html
@@ -613,7 +613,8 @@
             <span>Comment Threads</span></gr-tooltip-content>
         </paper-tab>
       </paper-tabs>
-      <template is="dom-if" if="[[_showMessagesView]]">
+      <template is="dom-if" if="[[_isSelectedView(_currentView,
+        _commentTabs.CHANGE_LOG)]]">
         <gr-messages-list
             class="hideOnMobileOverlay"
             change-num="[[_changeNum]]"
@@ -626,7 +627,8 @@
             on-message-anchor-tap="_handleMessageAnchorTap"
             on-reply="_handleMessageReply"></gr-messages-list>
       </template>
-      <template is="dom-if" if="[[!_showMessagesView]]">
+      <template is="dom-if" if="[[_isSelectedView(_currentView,
+        _commentTabs.COMMENT_THREADS)]]">
         <gr-thread-list
             threads="[[_commentThreads]]"
             change="[[_change]]"
diff --git a/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.js b/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.js
index 7536c2c..6a04445 100644
--- a/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.js
+++ b/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.js
@@ -59,6 +59,11 @@
     UNIFIED: 'UNIFIED_DIFF',
   };
 
+  const CommentTabs = {
+    CHANGE_LOG: 0,
+    COMMENT_THREADS: 1,
+  };
+
   const CHANGE_DATA_TIMING_LABEL = 'ChangeDataLoaded';
   const CHANGE_RELOAD_TIMING_LABEL = 'ChangeReloaded';
   const SEND_REPLY_TIMING_LABEL = 'SendReply';
@@ -193,6 +198,10 @@
           type: String,
           value: '',
         },
+        _commentTabs: {
+          type: Object,
+          value: CommentTabs,
+        },
         _lineHeight: Number,
         _changeIdCommitMessageError: {
           type: String,
@@ -280,9 +289,9 @@
           type: Boolean,
           value: undefined,
         },
-        _showMessagesView: {
-          type: Boolean,
-          value: true,
+        _currentView: {
+          type: Number,
+          value: CommentTabs.CHANGE_LOG,
         },
         _showFileTabContent: {
           type: Boolean,
@@ -460,7 +469,11 @@
     }
 
     _handleCommentTabChange() {
-      this._showMessagesView = this.$.commentTabs.selected === 0;
+      this._currentView = this.$.commentTabs.selected;
+    }
+
+    _isSelectedView(currentView, view) {
+      return currentView === view;
     }
 
     _handleFileTabChange(e) {
@@ -773,8 +786,7 @@
       // get messed up if changed here, because it requires the tabs to be on
       // the streen, and they are hidden shortly after this. The tab switching
       // animation will happen in post render tasks.
-      this._showMessagesView = true;
-
+      this._currentView = CommentTabs.CHANGE_LOG;
       if (value.view !== Gerrit.Nav.View.CHANGE) {
         this._initialLoadComplete = false;
         return;
diff --git a/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view_test.html b/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view_test.html
index 1ef79cf..5d38c2d 100644
--- a/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view_test.html
+++ b/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view_test.html
@@ -63,6 +63,11 @@
     let navigateToChangeStub;
     const TEST_SCROLL_TOP_PX = 100;
 
+    const CommentTabs = {
+      CHANGE_LOG: 0,
+      COMMENT_THREADS: 1,
+    };
+
     setup(() => {
       sandbox = sinon.sandbox.create();
       stub('gr-endpoint-decorator', {
@@ -375,7 +380,7 @@
 
     test('thread list modified', () => {
       sandbox.spy(element, '_handleReloadDiffComments');
-      element._showMessagesView = false;
+      element._currentView = CommentTabs.COMMENT_THREADS;
       flushAsynchronousOperations();
 
       return element._reloadComments().then(() => {
@@ -442,18 +447,18 @@
       // Wait for tab to get selected
       flush(() => {
         assert.equal(element.$.commentTabs.selected, 0);
-        assert.isTrue(element._showMessagesView);
+        assert.equal(element._currentView, CommentTabs.CHANGE_LOG);
         // Switch to comment thread tab
         MockInteractions.tap(element.$$('paper-tab.commentThreads'));
         assert.equal(element.$.commentTabs.selected, 1);
-        assert.isFalse(element._showMessagesView);
+        assert.equal(element._currentView, CommentTabs.COMMENT_THREADS);
 
         // When the change is partially reloaded (ex: Shift+R), the content
         // is swapped out before the tab, so messages list will display even
         // though the tab for comment threads is still temporarily selected.
         element._paramsChanged(element.params);
         assert.equal(element.$.commentTabs.selected, 1);
-        assert.isTrue(element._showMessagesView);
+        assert.equal(element._currentView, CommentTabs.CHANGE_LOG);
         done();
       });
     });
diff --git a/polygerrit-ui/app/elements/shared/gr-dropdown-list/gr-dropdown-list.html b/polygerrit-ui/app/elements/shared/gr-dropdown-list/gr-dropdown-list.html
index ee9e7a0..f7349eb 100644
--- a/polygerrit-ui/app/elements/shared/gr-dropdown-list/gr-dropdown-list.html
+++ b/polygerrit-ui/app/elements/shared/gr-dropdown-list/gr-dropdown-list.html
@@ -59,16 +59,19 @@
         cursor: pointer;
         flex-direction: column;
         font-size: inherit;
+        // This variable was introduced in Dec 2019. We keep both min-height
+        // rules around, because --paper-item-min-height is not yet upstreamed.
+        --paper-item-min-height: 0;
         --paper-item: {
           min-height: 0;
           padding: 10px 16px;
-        }
+        };
         --paper-item-focused-before: {
           background-color: var(--selection-background-color);
-        }
+        };
         --paper-item-focused: {
           background-color: var(--selection-background-color);
-        }
+        };
       }
       paper-item:hover {
         background-color: var(--hover-background-color);