SideBySide2: Do not offer 'r' keybinding to anonymous users
Anonymous users cannot mark a file as reviewed, as the server
has no way to track the stored flag. Disable the keybinding
so it does not appear in the help dialog.
Change-Id: I415a24754d1b4b5120b5b40e074ee697cf921b52
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/SideBySide2.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/SideBySide2.java
index 364d94c..7d8ee97 100644
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/SideBySide2.java
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/SideBySide2.java
@@ -421,12 +421,14 @@
keysAction.add(new NoOpKeyCommand(0, 'o', PatchUtil.C.expandComment()));
keysAction.add(new NoOpKeyCommand(
KeyCommand.M_SHIFT, 'o', PatchUtil.C.expandAllCommentsOnCurrentLine()));
- keysAction.add(new KeyCommand(0, 'r', PatchUtil.C.toggleReviewed()) {
- @Override
- public void onKeyPress(KeyPressEvent event) {
- header.toggleReviewed().run();
- }
- });
+ if (Gerrit.isSignedIn()) {
+ keysAction.add(new KeyCommand(0, 'r', PatchUtil.C.toggleReviewed()) {
+ @Override
+ public void onKeyPress(KeyPressEvent event) {
+ header.toggleReviewed().run();
+ }
+ });
+ }
keysAction.add(new KeyCommand(
KeyCommand.M_SHIFT, 'm', PatchUtil.C.markAsReviewedAndGoToNext()) {
@Override