BCC any user who has starred a change when sending related emails
If the user has starred the change, they are quite likely interested in seeing updates to it, and following its progress. BCC them on any emails we generate so they can be kept current. Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
@@ -27,4 +27,7 @@ public interface StarredChangeAccess extends
|
||||
|
||||
@Query("WHERE key.accountId = ?")
|
||||
ResultSet<StarredChange> byAccount(Account.Id id) throws OrmException;
|
||||
|
||||
@Query("WHERE key.changeId = ?")
|
||||
ResultSet<StarredChange> byChange(Change.Id id) throws OrmException;
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ import com.google.gerrit.client.reviewdb.PatchSet;
|
||||
import com.google.gerrit.client.reviewdb.PatchSetInfo;
|
||||
import com.google.gerrit.client.reviewdb.Project;
|
||||
import com.google.gerrit.client.reviewdb.ReviewDb;
|
||||
import com.google.gerrit.client.reviewdb.StarredChange;
|
||||
import com.google.gerrit.client.reviewdb.UserIdentity;
|
||||
import com.google.gerrit.client.rpc.Common;
|
||||
import com.google.gwtorm.client.OrmException;
|
||||
@@ -199,6 +200,7 @@ public class ChangeMail {
|
||||
return;
|
||||
}
|
||||
newChangeCc();
|
||||
starredTo();
|
||||
|
||||
body.append("Uploaded replacement patch set ");
|
||||
body.append(patchSet.getPatchSetId());
|
||||
@@ -260,6 +262,7 @@ public class ChangeMail {
|
||||
|
||||
initInReplyToChange();
|
||||
commentTo();
|
||||
starredTo();
|
||||
send();
|
||||
}
|
||||
}
|
||||
@@ -320,6 +323,7 @@ public class ChangeMail {
|
||||
|
||||
initInReplyToChange();
|
||||
submittedTo();
|
||||
starredTo();
|
||||
send();
|
||||
}
|
||||
}
|
||||
@@ -355,6 +359,7 @@ public class ChangeMail {
|
||||
|
||||
initInReplyToChange();
|
||||
commentTo();
|
||||
starredTo();
|
||||
send();
|
||||
}
|
||||
}
|
||||
@@ -500,6 +505,20 @@ public class ChangeMail {
|
||||
}
|
||||
}
|
||||
|
||||
private void starredTo() throws MessagingException {
|
||||
try {
|
||||
// BCC anyone else who has starred this change.
|
||||
//
|
||||
for (StarredChange w : db.starredChanges().byChange(change.getId())) {
|
||||
add(RecipientType.BCC, w.getAccountId());
|
||||
}
|
||||
} catch (OrmException err) {
|
||||
// Just don't CC everyone. Better to send a partial message to those
|
||||
// we already have queued up then to fail deliver entirely to people
|
||||
// who have a lower interest in the change.
|
||||
}
|
||||
}
|
||||
|
||||
private boolean begin(final String messageClass) throws MessagingException {
|
||||
if (transport != null) {
|
||||
msg = new MimeMessage(transport);
|
||||
|
||||
@@ -202,3 +202,6 @@ ON project_rights (category_id);
|
||||
-- *********************************************************************
|
||||
-- StarredChangeAccess
|
||||
-- @PrimaryKey covers: byAccount
|
||||
|
||||
CREATE INDEX starred_changes_byChange
|
||||
ON starred_changes (change_id);
|
||||
|
||||
@@ -17,5 +17,7 @@ CREATE INDEX account_project_watches_ntSub
|
||||
ON account_project_watches (project_id)
|
||||
WHERE notify_submitted_changes = 'Y';
|
||||
|
||||
CREATE INDEX starred_changes_byChange
|
||||
ON starred_changes (change_id);
|
||||
|
||||
UPDATE schema_version SET version_nbr = 7;
|
||||
|
||||
Reference in New Issue
Block a user