Fix returning of 'Email Reviewers' capability via REST

At the moment /accounts/self/capabilities/ doesn't return the
'Email Reviewers' capability when it is not explicitly assigned. This
is wrong since by default everyone has the 'Email Reviewers'
capability.

If 'Email Reviewers' capability is allowed or denied,
/accounts/self/capabilities/ returns the 'Email Reviewers' capability
always as true, which is wrong for the DENY case.

Change-Id: Ia6773bb89df875373298057f3fe32cc3fac88368
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
diff --git a/Documentation/rest-api-accounts.txt b/Documentation/rest-api-accounts.txt
index 1873475..840a42e 100644
--- a/Documentation/rest-api-accounts.txt
+++ b/Documentation/rest-api-accounts.txt
@@ -32,7 +32,8 @@
     "queryLimit": {
       "min": 0,
       "max": 500
-    }
+    },
+    "emailReviewers": true
   }
 ----
 
@@ -60,6 +61,7 @@
     "createAccount": true,
     "createGroup": true,
     "createProject": true,
+    "emailReviewers": true,
     "killTask": true,
     "viewCaches": true,
     "flushCaches": true,
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/account/GetCapabilities.java b/gerrit-server/src/main/java/com/google/gerrit/server/account/GetCapabilities.java
index 1868bd7..c0052b9 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/account/GetCapabilities.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/account/GetCapabilities.java
@@ -17,6 +17,7 @@
 import static com.google.gerrit.common.data.GlobalCapability.CREATE_ACCOUNT;
 import static com.google.gerrit.common.data.GlobalCapability.CREATE_GROUP;
 import static com.google.gerrit.common.data.GlobalCapability.CREATE_PROJECT;
+import static com.google.gerrit.common.data.GlobalCapability.EMAIL_REVIEWERS;
 import static com.google.gerrit.common.data.GlobalCapability.FLUSH_CACHES;
 import static com.google.gerrit.common.data.GlobalCapability.KILL_TASK;
 import static com.google.gerrit.common.data.GlobalCapability.PRIORITY;
@@ -101,6 +102,7 @@
     have.put(CREATE_ACCOUNT, cc.canCreateAccount());
     have.put(CREATE_GROUP, cc.canCreateGroup());
     have.put(CREATE_PROJECT, cc.canCreateProject());
+    have.put(EMAIL_REVIEWERS, cc.canEmailReviewers());
     have.put(KILL_TASK, cc.canKillTask());
     have.put(VIEW_CACHES, cc.canViewCaches());
     have.put(FLUSH_CACHES, cc.canFlushCaches());