Allow group descriptions to supply email and URL
Some backends have external management interfaces that are not embedded into Gerrit Code Review. Allow those backends to supply a URL to the web management interface for a group, so a user can manage their membership, view current members, or do whatever other features the group system might support. Some backends also have an email address associated with every group. Sending email to that address will distribute the message to the group's members. Permit backends to supply an optional email address, and use this in the project level notification system if a group is selected as the target for a message. Change-Id: Ifaebc01571c2db84872b2c08ff99c05389372f61
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
package com.google.gerrit.common;
|
||||
|
||||
import com.google.gerrit.common.data.ChangeInfo;
|
||||
import com.google.gerrit.reviewdb.client.AccountGroup;
|
||||
import com.google.gerrit.reviewdb.client.Change;
|
||||
import com.google.gerrit.reviewdb.client.Change.Status;
|
||||
import com.google.gerrit.reviewdb.client.PatchSet;
|
||||
@@ -101,6 +102,10 @@ public class PageLinks {
|
||||
return status(status) + " " + op("project", proj.get());
|
||||
}
|
||||
|
||||
public static String toGroup(AccountGroup.UUID uuid) {
|
||||
return ADMIN_GROUPS + "uuid-" + uuid;
|
||||
}
|
||||
|
||||
private static String status(Status status) {
|
||||
switch (status) {
|
||||
case ABANDONED:
|
||||
|
@@ -16,6 +16,8 @@ package com.google.gerrit.common.data;
|
||||
|
||||
import com.google.gerrit.reviewdb.client.AccountGroup;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* Group methods exposed by the GroupBackend.
|
||||
*/
|
||||
@@ -32,6 +34,22 @@ public class GroupDescription {
|
||||
|
||||
/** @return whether the group is visible to all accounts. */
|
||||
boolean isVisibleToAll();
|
||||
|
||||
/**
|
||||
* @return optional email address to send to the group's members. If
|
||||
* provided, Gerrit will use this email address to send
|
||||
* change notifications to the group.
|
||||
*/
|
||||
@Nullable
|
||||
String getEmailAddress();
|
||||
|
||||
/**
|
||||
* @return optional URL to information about the group. Typically a URL to a
|
||||
* web page that permits users to apply to join the group, or manage
|
||||
* their membership.
|
||||
*/
|
||||
@Nullable
|
||||
String getUrl();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -14,6 +14,7 @@
|
||||
|
||||
package com.google.gerrit.common.data;
|
||||
|
||||
import com.google.gerrit.common.PageLinks;
|
||||
import com.google.gerrit.reviewdb.client.AccountGroup;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
@@ -52,6 +53,18 @@ public class GroupDescriptions {
|
||||
public AccountGroup getAccountGroup() {
|
||||
return group;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public String getEmailAddress() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public String getUrl() {
|
||||
return "#" + PageLinks.toGroup(getGroupUUID());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
@@ -21,6 +21,7 @@ public class GroupInfo {
|
||||
protected AccountGroup.UUID uuid;
|
||||
protected String name;
|
||||
protected String description;
|
||||
protected String url;
|
||||
|
||||
protected GroupInfo() {
|
||||
}
|
||||
@@ -44,6 +45,7 @@ public class GroupInfo {
|
||||
public GroupInfo(GroupDescription.Basic a) {
|
||||
uuid = a.getGroupUUID();
|
||||
name = a.getName();
|
||||
url = a.getUrl();
|
||||
|
||||
if (a instanceof GroupDescription.Internal) {
|
||||
AccountGroup group = ((GroupDescription.Internal) a).getAccountGroup();
|
||||
@@ -65,4 +67,8 @@ public class GroupInfo {
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user