Add new notify type that allows watching abandoning of changes

Users can now watch the abandoning of changes.

Watching 'all_comments' already includes notification on abandoning of
changes, but some users that watch 'new_changes' want to get
notified on abandon without getting notifications for all other
comments.

Bug: issue 1686
Change-Id: I910a3adf41e6e979400523eb923ff9780ca77853
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
This commit is contained in:
Edwin Kempin
2013-01-11 08:10:52 +01:00
committed by Edwin Kempin
parent 89136bc832
commit 3a82961084
8 changed files with 48 additions and 3 deletions

View File

@@ -95,6 +95,7 @@ are sent.
* `new_patchsets`: Only newly created patch sets.
* `all_comments`: Only comments on existing changes.
* `submitted_changes`: Only changes that have been submitted.
* `abandoned_changes`: Only changes that have been abandoned.
* `all`: All notifications.
+

View File

@@ -99,6 +99,7 @@ public interface AccountConstants extends Constants {
String watchedProjectColumnNewPatchSets();
String watchedProjectColumnAllComments();
String watchedProjectColumnSubmittedChanges();
String watchedProjectColumnAbandonedChanges();
String contactFieldFullName();
String contactFieldEmail();

View File

@@ -98,6 +98,7 @@ watchedProjectColumnNewChanges = New Changes
watchedProjectColumnNewPatchSets = New Patch Sets
watchedProjectColumnAllComments = All Comments
watchedProjectColumnSubmittedChanges = Submitted Changes
watchedProjectColumnAbandonedChanges = Abandoned Changes
contactFieldFullName = Full Name
contactFieldEmail = Preferred Email

View File

@@ -51,15 +51,17 @@ public class MyWatchesTable extends FancyFlexTable<AccountProjectWatchInfo> {
fmt.setRowSpan(0, 2, 2);
DOM.setElementProperty(fmt.getElement(0, 3), "align", "center");
fmt.setColSpan(0, 3, 4);
fmt.setColSpan(0, 3, 5);
table.setText(1, 0, Util.C.watchedProjectColumnNewChanges());
table.setText(1, 1, Util.C.watchedProjectColumnNewPatchSets());
table.setText(1, 2, Util.C.watchedProjectColumnAllComments());
table.setText(1, 3, Util.C.watchedProjectColumnSubmittedChanges());
table.setText(1, 4, Util.C.watchedProjectColumnAbandonedChanges());
fmt.addStyleName(1, 0, Gerrit.RESOURCES.css().dataHeader());
fmt.addStyleName(1, 1, Gerrit.RESOURCES.css().dataHeader());
fmt.addStyleName(1, 2, Gerrit.RESOURCES.css().dataHeader());
fmt.addStyleName(1, 3, Gerrit.RESOURCES.css().dataHeader());
fmt.addStyleName(1, 4, Gerrit.RESOURCES.css().dataHeader());
}
public void deleteChecked() {
@@ -140,6 +142,7 @@ public class MyWatchesTable extends FancyFlexTable<AccountProjectWatchInfo> {
addNotifyButton(AccountProjectWatch.NotifyType.NEW_PATCHSETS, info, row, 4);
addNotifyButton(AccountProjectWatch.NotifyType.ALL_COMMENTS, info, row, 5);
addNotifyButton(AccountProjectWatch.NotifyType.SUBMITTED_CHANGES, info, row, 6);
addNotifyButton(AccountProjectWatch.NotifyType.ABANDONED_CHANGES, info, row, 7);
final FlexCellFormatter fmt = table.getFlexCellFormatter();
fmt.addStyleName(row, 1, Gerrit.RESOURCES.css().iconCell());
@@ -148,6 +151,7 @@ public class MyWatchesTable extends FancyFlexTable<AccountProjectWatchInfo> {
fmt.addStyleName(row, 4, Gerrit.RESOURCES.css().dataCell());
fmt.addStyleName(row, 5, Gerrit.RESOURCES.css().dataCell());
fmt.addStyleName(row, 6, Gerrit.RESOURCES.css().dataCell());
fmt.addStyleName(row, 7, Gerrit.RESOURCES.css().dataCell());
setRowItem(row, info);
}

View File

@@ -22,7 +22,8 @@ import com.google.gwtorm.client.StringKey;
public final class AccountProjectWatch {
public enum NotifyType {
NEW_CHANGES, NEW_PATCHSETS, ALL_COMMENTS, SUBMITTED_CHANGES, ALL
NEW_CHANGES, NEW_PATCHSETS, ALL_COMMENTS, SUBMITTED_CHANGES,
ABANDONED_CHANGES, ALL
}
public static final String FILTER_ALL = "*";
@@ -112,6 +113,9 @@ public final class AccountProjectWatch {
@Column(id = 5)
protected boolean notifyNewPatchSets;
@Column(id = 6)
protected boolean notifyAbandonedChanges;
protected AccountProjectWatch() {
}
@@ -149,6 +153,9 @@ public final class AccountProjectWatch {
case SUBMITTED_CHANGES:
return notifySubmittedChanges;
case ABANDONED_CHANGES:
return notifyAbandonedChanges;
case ALL:
break;
}
@@ -173,11 +180,16 @@ public final class AccountProjectWatch {
notifySubmittedChanges = v;
break;
case ABANDONED_CHANGES:
notifyAbandonedChanges = v;
break;
case ALL:
notifyNewChanges = v;
notifyNewPatchSets = v;
notifyAllComments = v;
notifySubmittedChanges = v;
notifyAbandonedChanges = v;
break;
}
}

View File

@@ -40,6 +40,7 @@ public class AbandonedSender extends ReplyToChangeSender {
ccAllApprovals();
bccStarredBy();
includeWatchers(NotifyType.ABANDONED_CHANGES);
includeWatchers(NotifyType.ALL_COMMENTS);
}

View File

@@ -32,7 +32,7 @@ import java.util.List;
/** A version of the database schema. */
public abstract class SchemaVersion {
/** The current schema version. */
public static final Class<Schema_75> C = Schema_75.class;
public static final Class<Schema_76> C = Schema_76.class;
public static class Module extends AbstractModule {
@Override

View File

@@ -0,0 +1,25 @@
// Copyright (C) 2013 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.gerrit.server.schema;
import com.google.inject.Inject;
import com.google.inject.Provider;
public class Schema_76 extends SchemaVersion {
@Inject
Schema_76(Provider<Schema_75> prior) {
super(prior);
}
}