Removed the AccountGroup emailOnlyAuthors flag.

The functionality has been replaced with a global capability in
All-Projects project.config with the name emailReviewers. The
emailyOnlyAuthors groups will be listed with the deny permission in the
next change.

Change-Id: I67506956e2689c0840d4a37235c733d23fe1e7ad
This commit is contained in:
Colby Ranger
2012-04-10 14:27:06 -07:00
parent d9488f0c37
commit 74d093d93d
10 changed files with 19 additions and 82 deletions

View File

@@ -22,22 +22,15 @@ import com.google.gerrit.reviewdb.client.AccountGroup;
public class GroupOptions {
private boolean visibleToAll;
private boolean emailOnlyAuthors;
protected GroupOptions() {
}
public GroupOptions(final boolean visibleToAll,
final boolean emailOnlyAuthors) {
public GroupOptions(final boolean visibleToAll) {
this.visibleToAll = visibleToAll;
this.emailOnlyAuthors = emailOnlyAuthors;
}
public boolean isVisibleToAll() {
return visibleToAll;
}
public boolean isEmailOnlyAuthors() {
return emailOnlyAuthors;
}
}

View File

@@ -122,7 +122,6 @@ public interface GerritCss extends CssResource {
String groupNamePanel();
String groupNameTextBox();
String groupOptionsPanel();
String groupOptionsNotificationsDescriptionPanel();
String groupOwnerPanel();
String groupOwnerTextBox();
String groupTypePanel();

View File

@@ -70,9 +70,7 @@ public class AccountGroupInfoScreen extends AccountGroupScreen {
private Button externalNameSearch;
private Grid externalMatches;
private Panel groupOptionsPanel;
private CheckBox visibleToAllCheckBox;
private CheckBox emailOnlyAuthors;
private Button saveGroupOptions;
public AccountGroupInfoScreen(final GroupDetail toShow, final String token) {
@@ -100,7 +98,6 @@ public class AccountGroupInfoScreen extends AccountGroupScreen {
externalNameFilter.setEnabled(canModify);
externalNameSearch.setEnabled(canModify);
visibleToAllCheckBox.setEnabled(canModify);
emailOnlyAuthors.setEnabled(canModify);
}
private void initUUID() {
@@ -207,20 +204,14 @@ public class AccountGroupInfoScreen extends AccountGroupScreen {
}
private void initGroupOptions() {
groupOptionsPanel = new VerticalPanel();
groupOptionsPanel.setStyleName(Gerrit.RESOURCES.css().groupOptionsPanel());
groupOptionsPanel.add(new SmallHeading(Util.C.headingGroupOptions()));
visibleToAllCheckBox = new CheckBox(Util.C.isVisibleToAll());
groupOptionsPanel.add(visibleToAllCheckBox);
emailOnlyAuthors = new CheckBox(Util.C.emailOnlyAuthors());
final VerticalPanel groupOptionsPanel = new VerticalPanel();
final VerticalPanel vp = new VerticalPanel();
vp.setStyleName(Gerrit.RESOURCES.css()
.groupOptionsNotificationsDescriptionPanel());
vp.add(new Label(Util.C.descriptionNotifications()));
vp.add(emailOnlyAuthors);
vp.setStyleName(Gerrit.RESOURCES.css().groupOptionsPanel());
vp.add(new SmallHeading(Util.C.headingGroupOptions()));
visibleToAllCheckBox = new CheckBox(Util.C.isVisibleToAll());
vp.add(visibleToAllCheckBox);
groupOptionsPanel.add(vp);
saveGroupOptions = new Button(Util.C.buttonSaveGroupOptions());
@@ -229,8 +220,7 @@ public class AccountGroupInfoScreen extends AccountGroupScreen {
@Override
public void onClick(final ClickEvent event) {
final GroupOptions groupOptions =
new GroupOptions(visibleToAllCheckBox.getValue(),
emailOnlyAuthors.getValue());
new GroupOptions(visibleToAllCheckBox.getValue());
Util.GROUP_SVC.changeGroupOptions(getGroupId(), groupOptions,
new GerritCallback<VoidResult>() {
public void onSuccess(final VoidResult result) {
@@ -245,7 +235,6 @@ public class AccountGroupInfoScreen extends AccountGroupScreen {
final OnEditEnabler enabler = new OnEditEnabler(saveGroupOptions);
enabler.listenTo(visibleToAllCheckBox);
enabler.listenTo(emailOnlyAuthors);
}
private void initGroupType() {
@@ -460,7 +449,6 @@ public class AccountGroupInfoScreen extends AccountGroupScreen {
descTxt.setText(group.getDescription());
visibleToAllCheckBox.setValue(group.isVisibleToAll());
emailOnlyAuthors.setValue(group.isEmailOnlyAuthors());
switch (group.getType()) {
case LDAP:

View File

@@ -44,8 +44,6 @@ public interface AdminConstants extends Constants {
String requireChangeID();
String headingGroupOptions();
String isVisibleToAll();
String emailOnlyAuthors();
String descriptionNotifications();
String buttonSaveGroupOptions();
String suggestedGroupLabel();
String parentSuggestions();

View File

@@ -29,9 +29,6 @@ headingParentProjectName = Rights Inherit From
parentSuggestions = Parent Suggestion
columnProjectName = Project Name
emailOnlyAuthors = Authors
descriptionNotifications = Send email notifications about comments and actions by users in this group only to:
headingGroupUUID = Group UUID
headingOwner = Owners
headingDescription = Description

View File

@@ -32,6 +32,8 @@ import java.util.List;
public class GroupTable extends NavigationTable<AccountGroup> {
private static final int NUM_COLS = 5;
private final boolean enableLink;
public GroupTable(final boolean enableLink) {
@@ -52,8 +54,7 @@ public class GroupTable extends NavigationTable<AccountGroup> {
table.setText(0, 2, Util.C.columnGroupDescription());
table.setText(0, 3, Util.C.headingOwner());
table.setText(0, 4, Util.C.columnGroupType());
table.setText(0, 5, Util.C.columnGroupNotifications());
table.setText(0, 6, Util.C.columnGroupVisibleToAll());
table.setText(0, 5, Util.C.columnGroupVisibleToAll());
table.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
@@ -66,12 +67,9 @@ public class GroupTable extends NavigationTable<AccountGroup> {
});
final FlexCellFormatter fmt = table.getFlexCellFormatter();
fmt.addStyleName(0, 1, Gerrit.RESOURCES.css().dataHeader());
fmt.addStyleName(0, 2, Gerrit.RESOURCES.css().dataHeader());
fmt.addStyleName(0, 3, Gerrit.RESOURCES.css().dataHeader());
fmt.addStyleName(0, 4, Gerrit.RESOURCES.css().dataHeader());
fmt.addStyleName(0, 5, Gerrit.RESOURCES.css().dataHeader());
fmt.addStyleName(0, 6, Gerrit.RESOURCES.css().dataHeader());
for (int i = 1; i <= NUM_COLS; i++) {
fmt.addStyleName(0, i, Gerrit.RESOURCES.css().dataHeader());
}
}
@Override
@@ -107,21 +105,15 @@ public class GroupTable extends NavigationTable<AccountGroup> {
table.setText(row, 2, k.getDescription());
table.setText(row, 3, detail.ownerGroup.getName());
table.setText(row, 4, k.getType().toString());
if (k.isEmailOnlyAuthors()) {
table.setWidget(row, 5, new Image(Gerrit.RESOURCES.greenCheck()));
}
if (k.isVisibleToAll()) {
table.setWidget(row, 6, new Image(Gerrit.RESOURCES.greenCheck()));
table.setWidget(row, 5, new Image(Gerrit.RESOURCES.greenCheck()));
}
final FlexCellFormatter fmt = table.getFlexCellFormatter();
fmt.addStyleName(row, 1, Gerrit.RESOURCES.css().dataCell());
fmt.addStyleName(row, 1, Gerrit.RESOURCES.css().groupName());
fmt.addStyleName(row, 2, Gerrit.RESOURCES.css().dataCell());
fmt.addStyleName(row, 3, Gerrit.RESOURCES.css().dataCell());
fmt.addStyleName(row, 4, Gerrit.RESOURCES.css().dataCell());
fmt.addStyleName(row, 5, Gerrit.RESOURCES.css().dataCell());
fmt.addStyleName(row, 6, Gerrit.RESOURCES.css().dataCell());
for (int i = 1; i <= NUM_COLS; i++) {
fmt.addStyleName(row, i, Gerrit.RESOURCES.css().dataCell());
}
setRowItem(row, k);
}

View File

@@ -1310,10 +1310,6 @@ a:hover.downloadLink {
margin-bottom: 2px;
}
.groupOptionsPanel {
margin-bottom: 3px;
}
.groupOptionsNotificationsDescriptionPanel {
margin-top: 5px;
margin-bottom: 5px;
}
.groupOwnerPanel {

View File

@@ -131,7 +131,6 @@ class GroupAdminServiceImpl extends BaseServiceImplementation implements
final AccountGroup group = db.accountGroups().get(groupId);
assertAmGroupOwner(db, group);
group.setVisibleToAll(groupOptions.isVisibleToAll());
group.setEmailOnlyAuthors(groupOptions.isEmailOnlyAuthors());
db.accountGroups().update(Collections.singleton(group));
groupCache.evict(group);
return VoidResult.INSTANCE;

View File

@@ -216,11 +216,6 @@ public final class AccountGroup {
@Column(id = 7)
protected boolean visibleToAll;
/** Comment and action email notifications by users in this group are only
* sent to change authors. */
@Column(id = 8)
protected boolean emailOnlyAuthors;
/** Globally unique identifier name for this group. */
@Column(id = 9)
protected UUID groupUUID;
@@ -294,14 +289,6 @@ public final class AccountGroup {
return visibleToAll;
}
public boolean isEmailOnlyAuthors() {
return emailOnlyAuthors;
}
public void setEmailOnlyAuthors(boolean emailOnlyAuthors) {
this.emailOnlyAuthors = emailOnlyAuthors;
}
public AccountGroup.UUID getGroupUUID() {
return groupUUID;
}

View File

@@ -70,19 +70,7 @@ public abstract class ChangeEmail extends OutgoingEmail {
/** Is the from user in an email squelching group? */
final IdentifiedUser user = args.identifiedUserFactory.create(id);
if (!user.getCapabilities().canEmailReviewers()) {
emailOnlyAuthors = true;
} else {
// TODO(cranger): remove once the schema is migrated in the next patch.
final Set<AccountGroup.UUID> gids = user.getEffectiveGroups().getKnownGroups();
for (final AccountGroup.UUID gid : gids) {
AccountGroup group = args.groupCache.get(gid);
if (group != null && group.isEmailOnlyAuthors()) {
emailOnlyAuthors = true;
break;
}
}
}
emailOnlyAuthors = !user.getCapabilities().canEmailReviewers();
}
public void setPatchSet(final PatchSet ps) {