Delete ignored state and 'star:' queries.
This deletes 'star:ignored', 'is:ignored' and 'star:star'.
The latter is identical to 'is:starred' or 'has:star'.
This is an exact re-land of https://gerrit-review.googlesource.com/c/gerrit/+/343395
It had rolled out too early as the frontend needed to wait for
https://gerrit-review.googlesource.com/c/gerrit/+/342839 to be released to the frontend, including in a rollback path.
Change-Id: Ia557409f11a5f5bde491163cf83912d18047ae9d
Google-Bug-Id: b/242827284
Release-Notes: Delete ignored state of changes and 'star:' queries
diff --git a/Documentation/config-accounts.txt b/Documentation/config-accounts.txt
index aca9591..716fa2f 100644
--- a/Documentation/config-accounts.txt
+++ b/Documentation/config-accounts.txt
@@ -383,8 +383,8 @@
[[starred-changes]]
== Starred Changes
-link:dev-stars.html[Starred changes] allow users to mark changes as
-favorites and receive email notifications for them.
+Starred changes allow users to mark changes as favorites and receive email
+notifications for them.
Each starred change is a tuple of an account ID, a change ID and a
label.
@@ -402,8 +402,7 @@
when the prefix ends with '/', this ref format is optimized to find
starred changes by change ID. Finding starred changes by change ID is
e.g. needed when a change is updated so that all users that have
-the link:dev-stars.html#default-star[default star] on the change can be
-notified by email.
+the star on the change can be notified by email.
Gerrit also needs an efficient way to find all changes that were
starred by an account, e.g. to provide results for the
diff --git a/Documentation/dev-community.txt b/Documentation/dev-community.txt
index 7488f74..47c0be2 100644
--- a/Documentation/dev-community.txt
+++ b/Documentation/dev-community.txt
@@ -54,7 +54,6 @@
* link:dev-build-plugins.html[Building Gerrit plugins]
* link:pg-plugin-dev.html[JavaScript Plugin Development and API]
* link:config-validation.html[Validation Interfaces]
-* link:dev-stars.html[Starring Changes]
* link:quota.html[Quota Enforcement]
[[maintainer]]
diff --git a/Documentation/dev-stars.txt b/Documentation/dev-stars.txt
deleted file mode 100644
index 764e326..0000000
--- a/Documentation/dev-stars.txt
+++ /dev/null
@@ -1,82 +0,0 @@
-= Gerrit Code Review - Stars
-
-== Description
-
-Changes can be starred with labels that behave like private hashtags.
-Any label can be applied to a change, but these labels are only visible
-to the user for which the labels have been set.
-
-Stars allow users to categorize changes by self-defined criteria and
-then build link:user-dashboards.html[dashboards] for them by making use
-of the link:#query-stars[star query operators].
-
-[[star-api]]
-== Star API
-
-The link:rest-api-accounts.html#star-endpoints[star REST API] supports:
-
-* link:rest-api-accounts.html#get-stars[
- get star labels from a change]
-* link:rest-api-accounts.html#set-stars[
- update star labels on a change]
-* link:rest-api-accounts.html#get-starred-changes[
- list changes that are starred by any label]
-
-Star labels are also included in
-link:rest-api-changes.html#change-info[ChangeInfo] entities that are
-returned by the link:rest-api-changes.html[changes REST API].
-
-There are link:rest-api-accounts.html#default-star-endpoints[
-additional REST endpoints] for the link:#default-star[default star].
-
-[[default-star]]
-== Default Star
-
-If the default star is set by a user, this user is automatically
-notified by email whenever updates are made to that change.
-
-The default star is the star that is shown in the WebUI and which can
-be updated from there.
-
-The default star is represented by the special star label 'star'.
-
-[[ignore-star]]
-== Ignore Star
-
-If the ignore star is set by a user, this user gets no email
-notifications for updates of that change, even if this user is a
-reviewer of the change or the change is matched by a project watch of
-the user.
-
-Since changes can only be ignored once they are created, users that
-watch a project will always get the email notifications for the change
-creation. Only then the change can be ignored.
-
-Users that are added as reviewer or assignee to a change that they have
-ignored will be notified about this, so that they know about the review
-request. They can then decide to remove the ignore star.
-
-The ignore star is represented by the special star label 'ignore'.
-
-[[query-stars]]
-== Query Stars
-
-There are several query operators to find changes with stars:
-
-* link:user-search.html#is-starred[is:starred] /
- link:user-search.html#has-star[has:star]:
- Matches any change that was starred by the current user with the
- link:#default-star[default star].
-
-[[syntax]]
-== Syntax
-
-Star labels cannot contain whitespace characters. All other characters
-are allowed.
-
-GERRIT
-------
-Part of link:index.html[Gerrit Code Review]
-
-SEARCHBOX
----------
diff --git a/Documentation/intro-user.txt b/Documentation/intro-user.txt
index 2ae1a50..264ce73 100644
--- a/Documentation/intro-user.txt
+++ b/Documentation/intro-user.txt
@@ -671,19 +671,6 @@
or build artifacts containing build numbers) can fetch the code
using the commit ID.
-[[ignore]]
-== Ignoring Or Marking Changes As 'Reviewed'
-
-Changes can be ignored, which means they will not appear in the 'Incoming
-Reviews' dashboard and any related email notifications will be suppressed.
-This can be useful when you are added as a reviewer to a change on which
-you do not actively participate in the review, but do not want to completely
-remove yourself.
-
-Alternatively, rather than completely ignoring the change, it can be marked
-as 'Reviewed'. Marking a change as 'Reviewed' means it will not be highlighted
-in the dashboard, until a new patch set is uploaded.
-
[[inline-edit]]
== Inline Edit
diff --git a/Documentation/rest-api-changes.txt b/Documentation/rest-api-changes.txt
index 0c5f96f..ab7fb3b 100644
--- a/Documentation/rest-api-changes.txt
+++ b/Documentation/rest-api-changes.txt
@@ -2579,35 +2579,6 @@
}
----
-[[ignore]]
-=== Ignore
---
-'PUT /changes/link:#change-id[\{change-id\}]/ignore'
---
-
-Marks a change as ignored. The change will not be shown in the incoming
-reviews dashboard, and email notifications will be suppressed. Ignoring
-a change does not cause the change's "updated" timestamp to be modified,
-and the owner is not notified.
-
-.Request
-----
- PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/ignore HTTP/1.0
-----
-
-[[unignore]]
-=== Unignore
---
-'PUT /changes/link:#change-id[\{change-id\}]/unignore'
---
-
-Un-marks a change as ignored.
-
-.Request
-----
- PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/unignore HTTP/1.0
-----
-
[[get-hashtags]]
=== Get Hashtags
--
diff --git a/Documentation/user-search.txt b/Documentation/user-search.txt
index 392c12a..8239d62 100644
--- a/Documentation/user-search.txt
+++ b/Documentation/user-search.txt
@@ -433,19 +433,6 @@
Matches any change that has a commit message with a footer where the footer
name is equal to 'FOOTERNAME'.The matching is done case-sensitive.
-[[star]]
-star:'LABEL'::
-+
-Matches any change that was starred by the current user with the label
-'LABEL'.
-+
-E.g. if changes that are not interesting are marked with an `ignore`
-star, they could be filtered out by '-star:ignore'.
-+
-'star:star' is the same as 'has:star' and 'is:starred'.
-
-Only "ignore" and "star" are supported labels.
-
[[has]]
has:draft::
+
@@ -454,8 +441,8 @@
[[has-star]]
has:star::
+
-Same as 'is:starred' and 'star:star', true if the change has been
-starred by the current user with the default label.
+Same as 'is:starred', true if the change has been starred by the current user
+with the default label.
has:edit::
+
@@ -558,11 +545,6 @@
link:config-gerrit.html#change.mergeabilityComputationBehavior[change.mergeabilityComputationBehavior]
for details.
-[[ignored]]
-is:ignored::
-+
-True if the change is ignored. Same as `star:ignore`.
-
[[private]]
is:private::
+
diff --git a/java/com/google/gerrit/extensions/api/changes/ChangeApi.java b/java/com/google/gerrit/extensions/api/changes/ChangeApi.java
index 19d129a..018a6cf 100644
--- a/java/com/google/gerrit/extensions/api/changes/ChangeApi.java
+++ b/java/com/google/gerrit/extensions/api/changes/ChangeApi.java
@@ -128,20 +128,6 @@
}
/**
- * Ignore or un-ignore this change.
- *
- * @param ignore ignore the change if true
- */
- void ignore(boolean ignore) throws RestApiException;
-
- /**
- * Check if this change is ignored.
- *
- * @return true if the change is ignored
- */
- boolean ignored() throws RestApiException;
-
- /**
* Create a new change that reverts this change.
*
* @see Changes#id(int)
@@ -838,16 +824,6 @@
}
@Override
- public void ignore(boolean ignore) throws RestApiException {
- throw new NotImplementedException();
- }
-
- @Override
- public boolean ignored() throws RestApiException {
- throw new NotImplementedException();
- }
-
- @Override
public PureRevertInfo pureRevert() throws RestApiException {
throw new NotImplementedException();
}
diff --git a/java/com/google/gerrit/server/StarredChangesUtil.java b/java/com/google/gerrit/server/StarredChangesUtil.java
index 95d891e..3e44adc 100644
--- a/java/com/google/gerrit/server/StarredChangesUtil.java
+++ b/java/com/google/gerrit/server/StarredChangesUtil.java
@@ -37,7 +37,6 @@
import com.google.gerrit.exceptions.StorageException;
import com.google.gerrit.git.GitUpdateFailureException;
import com.google.gerrit.git.LockFailureException;
-import com.google.gerrit.server.change.ChangeResource;
import com.google.gerrit.server.config.AllUsersName;
import com.google.gerrit.server.extensions.events.GitReferenceUpdated;
import com.google.gerrit.server.git.GitRepositoryManager;
@@ -158,7 +157,6 @@
}
public static final String DEFAULT_LABEL = "star";
- public static final String IGNORE_LABEL = "ignore";
public static final ImmutableSortedSet<String> DEFAULT_LABELS =
ImmutableSortedSet.of(DEFAULT_LABEL);
@@ -219,7 +217,6 @@
if (labels.isEmpty()) {
deleteRef(repo, refName, old.objectId());
} else {
- checkMutuallyExclusiveLabels(labels);
updateLabels(repo, refName, old.objectId(), labels);
}
@@ -349,32 +346,6 @@
}
}
- public void ignore(ChangeResource rsrc) throws IllegalLabelException {
- star(
- rsrc.getUser().asIdentifiedUser().getAccountId(),
- rsrc.getProject(),
- rsrc.getChange().getId(),
- ImmutableSet.of(IGNORE_LABEL),
- ImmutableSet.of());
- }
-
- public void unignore(ChangeResource rsrc) throws IllegalLabelException {
- star(
- rsrc.getUser().asIdentifiedUser().getAccountId(),
- rsrc.getProject(),
- rsrc.getChange().getId(),
- ImmutableSet.of(),
- ImmutableSet.of(IGNORE_LABEL));
- }
-
- public boolean isIgnoredBy(Change.Id changeId, Account.Id accountId) {
- return getLabels(accountId, changeId).contains(IGNORE_LABEL);
- }
-
- public boolean isIgnored(ChangeResource rsrc) {
- return isIgnoredBy(rsrc.getChange().getId(), rsrc.getUser().asIdentifiedUser().getAccountId());
- }
-
public static StarRef readLabels(Repository repo, String refName) throws IOException {
try (TraceTimer traceTimer =
TraceContext.newTimer(
@@ -414,13 +385,6 @@
}
}
- private static void checkMutuallyExclusiveLabels(Set<String> labels)
- throws MutuallyExclusiveLabelsException {
- if (labels.containsAll(ImmutableSet.of(DEFAULT_LABEL, IGNORE_LABEL))) {
- throw new MutuallyExclusiveLabelsException(DEFAULT_LABEL, IGNORE_LABEL);
- }
- }
-
private static void validateLabels(Collection<String> labels) throws InvalidLabelsException {
if (labels == null) {
return;
diff --git a/java/com/google/gerrit/server/api/changes/ChangeApiImpl.java b/java/com/google/gerrit/server/api/changes/ChangeApiImpl.java
index 9635d41..1713171 100644
--- a/java/com/google/gerrit/server/api/changes/ChangeApiImpl.java
+++ b/java/com/google/gerrit/server/api/changes/ChangeApiImpl.java
@@ -19,7 +19,6 @@
import com.google.common.collect.ImmutableListMultimap;
import com.google.common.collect.ListMultimap;
import com.google.gerrit.common.Nullable;
-import com.google.gerrit.exceptions.StorageException;
import com.google.gerrit.extensions.api.changes.AbandonInput;
import com.google.gerrit.extensions.api.changes.AssigneeInput;
import com.google.gerrit.extensions.api.changes.AttentionSetApi;
@@ -65,8 +64,6 @@
import com.google.gerrit.extensions.restapi.Response;
import com.google.gerrit.extensions.restapi.RestApiException;
import com.google.gerrit.server.DynamicOptions;
-import com.google.gerrit.server.StarredChangesUtil;
-import com.google.gerrit.server.StarredChangesUtil.IllegalLabelException;
import com.google.gerrit.server.change.ChangeMessageResource;
import com.google.gerrit.server.change.ChangeResource;
import com.google.gerrit.server.change.WorkInProgressOp;
@@ -88,7 +85,6 @@
import com.google.gerrit.server.restapi.change.GetPastAssignees;
import com.google.gerrit.server.restapi.change.GetPureRevert;
import com.google.gerrit.server.restapi.change.GetTopic;
-import com.google.gerrit.server.restapi.change.Ignore;
import com.google.gerrit.server.restapi.change.Index;
import com.google.gerrit.server.restapi.change.ListChangeComments;
import com.google.gerrit.server.restapi.change.ListChangeDrafts;
@@ -111,7 +107,6 @@
import com.google.gerrit.server.restapi.change.SetWorkInProgress;
import com.google.gerrit.server.restapi.change.SubmittedTogether;
import com.google.gerrit.server.restapi.change.SuggestChangeReviewers;
-import com.google.gerrit.server.restapi.change.Unignore;
import com.google.gerrit.util.cli.CmdLineParser;
import com.google.inject.Inject;
import com.google.inject.Injector;
@@ -172,13 +167,10 @@
private final Move move;
private final PostPrivate postPrivate;
private final DeletePrivate deletePrivate;
- private final Ignore ignore;
- private final Unignore unignore;
private final SetWorkInProgress setWip;
private final SetReadyForReview setReady;
private final PutMessage putMessage;
private final Provider<GetPureRevert> getPureRevertProvider;
- private final StarredChangesUtil stars;
private final DynamicOptionParser dynamicOptionParser;
private final Injector injector;
private final DynamicMap<DynamicOptions.DynamicBean> dynamicBeans;
@@ -227,13 +219,10 @@
Move move,
PostPrivate postPrivate,
DeletePrivate deletePrivate,
- Ignore ignore,
- Unignore unignore,
SetWorkInProgress setWip,
SetReadyForReview setReady,
PutMessage putMessage,
Provider<GetPureRevert> getPureRevertProvider,
- StarredChangesUtil stars,
DynamicOptionParser dynamicOptionParser,
@Assisted ChangeResource change,
Injector injector,
@@ -280,13 +269,10 @@
this.move = move;
this.postPrivate = postPrivate;
this.deletePrivate = deletePrivate;
- this.ignore = ignore;
- this.unignore = unignore;
this.setWip = setWip;
this.setReady = setReady;
this.putMessage = putMessage;
this.getPureRevertProvider = getPureRevertProvider;
- this.stars = stars;
this.dynamicOptionParser = dynamicOptionParser;
this.change = change;
this.injector = injector;
@@ -750,30 +736,6 @@
}
@Override
- public void ignore(boolean ignore) throws RestApiException {
- // TODO(dborowitz): Convert to RetryingRestModifyView. Needs to plumb BatchUpdate.Factory into
- // StarredChangesUtil.
- try {
- if (ignore) {
- this.ignore.apply(change, new Input());
- } else {
- unignore.apply(change, new Input());
- }
- } catch (StorageException | IllegalLabelException e) {
- throw asRestApiException("Cannot ignore change", e);
- }
- }
-
- @Override
- public boolean ignored() throws RestApiException {
- try {
- return stars.isIgnored(change);
- } catch (StorageException e) {
- throw asRestApiException("Cannot check if ignored", e);
- }
- }
-
- @Override
public PureRevertInfo pureRevert() throws RestApiException {
return pureRevert(null);
}
diff --git a/java/com/google/gerrit/server/mail/send/AbandonedSender.java b/java/com/google/gerrit/server/mail/send/AbandonedSender.java
index 3ac610d..d8b20ba 100644
--- a/java/com/google/gerrit/server/mail/send/AbandonedSender.java
+++ b/java/com/google/gerrit/server/mail/send/AbandonedSender.java
@@ -41,7 +41,6 @@
ccAllApprovals();
bccStarredBy();
includeWatchers(NotifyType.ABANDONED_CHANGES);
- removeUsersThatIgnoredTheChange();
}
@Override
diff --git a/java/com/google/gerrit/server/mail/send/AttentionSetSender.java b/java/com/google/gerrit/server/mail/send/AttentionSetSender.java
index f5af783..d1ee4ee 100644
--- a/java/com/google/gerrit/server/mail/send/AttentionSetSender.java
+++ b/java/com/google/gerrit/server/mail/send/AttentionSetSender.java
@@ -36,7 +36,6 @@
ccAllApprovals();
bccStarredBy();
ccExistingReviewers();
- removeUsersThatIgnoredTheChange();
}
public void setAttentionSetUser(Account.Id attentionSetUser) {
diff --git a/java/com/google/gerrit/server/mail/send/ChangeEmail.java b/java/com/google/gerrit/server/mail/send/ChangeEmail.java
index dcf8dd1..8be5548 100644
--- a/java/com/google/gerrit/server/mail/send/ChangeEmail.java
+++ b/java/com/google/gerrit/server/mail/send/ChangeEmail.java
@@ -392,14 +392,6 @@
}
}
- protected void removeUsersThatIgnoredTheChange() {
- for (Map.Entry<Account.Id, Collection<String>> e : stars.asMap().entrySet()) {
- if (e.getValue().contains(StarredChangesUtil.IGNORE_LABEL)) {
- args.accountCache.get(e.getKey()).ifPresent(a -> removeUser(a.account()));
- }
- }
- }
-
@Override
protected final Watchers getWatchers(NotifyType type, boolean includeWatchersFromNotifyConfig) {
if (!NotifyHandling.ALL.equals(notify.handling())) {
diff --git a/java/com/google/gerrit/server/mail/send/CommentSender.java b/java/com/google/gerrit/server/mail/send/CommentSender.java
index 0718b5e..3c821cc 100644
--- a/java/com/google/gerrit/server/mail/send/CommentSender.java
+++ b/java/com/google/gerrit/server/mail/send/CommentSender.java
@@ -176,7 +176,6 @@
bccStarredBy();
includeWatchers(NotifyType.ALL_COMMENTS, !change.isWorkInProgress() && !change.isPrivate());
}
- removeUsersThatIgnoredTheChange();
// Add header that enables identifying comments on parsed email.
// Grouping is currently done by timestamp.
diff --git a/java/com/google/gerrit/server/mail/send/DeleteReviewerSender.java b/java/com/google/gerrit/server/mail/send/DeleteReviewerSender.java
index 0de0dbe..70676e3 100644
--- a/java/com/google/gerrit/server/mail/send/DeleteReviewerSender.java
+++ b/java/com/google/gerrit/server/mail/send/DeleteReviewerSender.java
@@ -63,7 +63,6 @@
includeWatchers(NotifyType.ALL_COMMENTS);
reviewers.stream().forEach(r -> add(RecipientType.TO, r));
addByEmail(RecipientType.TO, reviewersByEmail);
- removeUsersThatIgnoredTheChange();
}
@Override
diff --git a/java/com/google/gerrit/server/mail/send/DeleteVoteSender.java b/java/com/google/gerrit/server/mail/send/DeleteVoteSender.java
index 77efbf8..f71cc00 100644
--- a/java/com/google/gerrit/server/mail/send/DeleteVoteSender.java
+++ b/java/com/google/gerrit/server/mail/send/DeleteVoteSender.java
@@ -41,7 +41,6 @@
ccAllApprovals();
bccStarredBy();
includeWatchers(NotifyType.ALL_COMMENTS);
- removeUsersThatIgnoredTheChange();
}
@Override
diff --git a/java/com/google/gerrit/server/mail/send/MergedSender.java b/java/com/google/gerrit/server/mail/send/MergedSender.java
index cec857d..693c669 100644
--- a/java/com/google/gerrit/server/mail/send/MergedSender.java
+++ b/java/com/google/gerrit/server/mail/send/MergedSender.java
@@ -62,7 +62,6 @@
bccStarredBy();
includeWatchers(NotifyType.ALL_COMMENTS);
includeWatchers(NotifyType.SUBMITTED_CHANGES);
- removeUsersThatIgnoredTheChange();
}
@Override
diff --git a/java/com/google/gerrit/server/mail/send/ModifyReviewerSender.java b/java/com/google/gerrit/server/mail/send/ModifyReviewerSender.java
index b187f9c..dcf3b6c 100644
--- a/java/com/google/gerrit/server/mail/send/ModifyReviewerSender.java
+++ b/java/com/google/gerrit/server/mail/send/ModifyReviewerSender.java
@@ -37,6 +37,5 @@
super.init();
ccExistingReviewers();
- removeUsersThatIgnoredTheChange();
}
}
diff --git a/java/com/google/gerrit/server/mail/send/ReplacePatchSetSender.java b/java/com/google/gerrit/server/mail/send/ReplacePatchSetSender.java
index 1b830d9..0d32dd5 100644
--- a/java/com/google/gerrit/server/mail/send/ReplacePatchSetSender.java
+++ b/java/com/google/gerrit/server/mail/send/ReplacePatchSetSender.java
@@ -91,7 +91,8 @@
protected boolean shouldSendMessage() {
if (!isChangeNoLongerSubmittable() && changeKind.isTrivialRebase()) {
logger.atFine().log(
- "skip email because new patch set is a trivial rebase that didn't make the change non-submittable");
+ "skip email because new patch set is a trivial rebase that didn't make the change"
+ + " non-submittable");
return false;
}
@@ -131,7 +132,6 @@
}
bccStarredBy();
includeWatchers(NotifyType.NEW_PATCHSETS, !change.isWorkInProgress() && !change.isPrivate());
- removeUsersThatIgnoredTheChange();
}
@Override
diff --git a/java/com/google/gerrit/server/mail/send/RestoredSender.java b/java/com/google/gerrit/server/mail/send/RestoredSender.java
index ffe70cf..e37d8f9 100644
--- a/java/com/google/gerrit/server/mail/send/RestoredSender.java
+++ b/java/com/google/gerrit/server/mail/send/RestoredSender.java
@@ -41,7 +41,6 @@
ccAllApprovals();
bccStarredBy();
includeWatchers(NotifyType.ALL_COMMENTS);
- removeUsersThatIgnoredTheChange();
}
@Override
diff --git a/java/com/google/gerrit/server/mail/send/RevertedSender.java b/java/com/google/gerrit/server/mail/send/RevertedSender.java
index c11529b..1d7223d 100644
--- a/java/com/google/gerrit/server/mail/send/RevertedSender.java
+++ b/java/com/google/gerrit/server/mail/send/RevertedSender.java
@@ -40,7 +40,6 @@
ccAllApprovals();
bccStarredBy();
includeWatchers(NotifyType.ALL_COMMENTS);
- removeUsersThatIgnoredTheChange();
}
@Override
diff --git a/java/com/google/gerrit/server/query/change/ChangeQueryBuilder.java b/java/com/google/gerrit/server/query/change/ChangeQueryBuilder.java
index 9e9a960..3ec16dd 100644
--- a/java/com/google/gerrit/server/query/change/ChangeQueryBuilder.java
+++ b/java/com/google/gerrit/server/query/change/ChangeQueryBuilder.java
@@ -731,10 +731,6 @@
return new IsSubmittablePredicate();
}
- if ("ignored".equalsIgnoreCase(value)) {
- return ignoredBySelf();
- }
-
if ("started".equalsIgnoreCase(value)) {
checkFieldAvailable(ChangeField.STARTED, "is:started");
return new BooleanPredicate(ChangeField.STARTED);
@@ -1122,26 +1118,6 @@
return ChangePredicates.message(text);
}
- @Operator
- public Predicate<ChangeData> star(String label) throws QueryParseException {
- if ("ignore".equalsIgnoreCase(label)) {
- return ignoredBySelf();
- }
- if ("star".equalsIgnoreCase(label)) {
- return starredBySelf();
- }
- throw new IllegalArgumentException();
- }
-
- private Predicate<ChangeData> ignoredBySelf() throws QueryParseException {
- return ChangePredicates.starBy(
- args.experimentFeatures.isFeatureEnabled(
- GERRIT_BACKEND_REQUEST_FEATURE_COMPUTE_FROM_ALL_USERS_REPOSITORY),
- args.starredChangesUtil,
- self(),
- StarredChangesUtil.IGNORE_LABEL);
- }
-
private Predicate<ChangeData> starredBySelf() throws QueryParseException {
return ChangePredicates.starBy(
args.experimentFeatures.isFeatureEnabled(
diff --git a/java/com/google/gerrit/server/restapi/change/ChangeRestApiModule.java b/java/com/google/gerrit/server/restapi/change/ChangeRestApiModule.java
index b8ccf5e..718759a 100644
--- a/java/com/google/gerrit/server/restapi/change/ChangeRestApiModule.java
+++ b/java/com/google/gerrit/server/restapi/change/ChangeRestApiModule.java
@@ -118,8 +118,6 @@
post(CHANGE_KIND, "private").to(PostPrivate.class);
post(CHANGE_KIND, "private.delete").to(DeletePrivateByPost.class);
delete(CHANGE_KIND, "private").to(DeletePrivate.class);
- put(CHANGE_KIND, "ignore").to(Ignore.class);
- put(CHANGE_KIND, "unignore").to(Unignore.class);
post(CHANGE_KIND, "wip").to(SetWorkInProgress.class);
post(CHANGE_KIND, "ready").to(SetReadyForReview.class);
put(CHANGE_KIND, "message").to(PutMessage.class);
diff --git a/java/com/google/gerrit/server/restapi/change/Ignore.java b/java/com/google/gerrit/server/restapi/change/Ignore.java
deleted file mode 100644
index a049e54..0000000
--- a/java/com/google/gerrit/server/restapi/change/Ignore.java
+++ /dev/null
@@ -1,81 +0,0 @@
-// Copyright (C) 2017 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.restapi.change;
-
-import com.google.common.flogger.FluentLogger;
-import com.google.gerrit.exceptions.StorageException;
-import com.google.gerrit.extensions.common.Input;
-import com.google.gerrit.extensions.restapi.BadRequestException;
-import com.google.gerrit.extensions.restapi.ResourceConflictException;
-import com.google.gerrit.extensions.restapi.Response;
-import com.google.gerrit.extensions.restapi.RestApiException;
-import com.google.gerrit.extensions.restapi.RestModifyView;
-import com.google.gerrit.extensions.webui.UiAction;
-import com.google.gerrit.server.StarredChangesUtil;
-import com.google.gerrit.server.StarredChangesUtil.IllegalLabelException;
-import com.google.gerrit.server.StarredChangesUtil.MutuallyExclusiveLabelsException;
-import com.google.gerrit.server.change.ChangeResource;
-import com.google.inject.Inject;
-import com.google.inject.Singleton;
-
-@Singleton
-public class Ignore implements RestModifyView<ChangeResource, Input>, UiAction<ChangeResource> {
- private static final FluentLogger logger = FluentLogger.forEnclosingClass();
-
- private final StarredChangesUtil stars;
-
- @Inject
- Ignore(StarredChangesUtil stars) {
- this.stars = stars;
- }
-
- @Override
- public Description getDescription(ChangeResource rsrc) {
- return new UiAction.Description()
- .setLabel("Ignore")
- .setTitle("Ignore the change")
- .setVisible(canIgnore(rsrc));
- }
-
- @Override
- public Response<String> apply(ChangeResource rsrc, Input input)
- throws RestApiException, IllegalLabelException {
- try {
- if (rsrc.isUserOwner()) {
- throw new BadRequestException("cannot ignore own change");
- }
-
- if (!isIgnored(rsrc)) {
- stars.ignore(rsrc);
- }
- return Response.ok();
- } catch (MutuallyExclusiveLabelsException e) {
- throw new ResourceConflictException(e.getMessage());
- }
- }
-
- private boolean canIgnore(ChangeResource rsrc) {
- return !rsrc.isUserOwner() && !isIgnored(rsrc);
- }
-
- private boolean isIgnored(ChangeResource rsrc) {
- try {
- return stars.isIgnored(rsrc);
- } catch (StorageException e) {
- logger.atSevere().withCause(e).log("failed to check ignored star");
- }
- return false;
- }
-}
diff --git a/java/com/google/gerrit/server/restapi/change/Unignore.java b/java/com/google/gerrit/server/restapi/change/Unignore.java
deleted file mode 100644
index 999e736..0000000
--- a/java/com/google/gerrit/server/restapi/change/Unignore.java
+++ /dev/null
@@ -1,64 +0,0 @@
-// Copyright (C) 2017 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.restapi.change;
-
-import com.google.common.flogger.FluentLogger;
-import com.google.gerrit.exceptions.StorageException;
-import com.google.gerrit.extensions.common.Input;
-import com.google.gerrit.extensions.restapi.Response;
-import com.google.gerrit.extensions.restapi.RestModifyView;
-import com.google.gerrit.extensions.webui.UiAction;
-import com.google.gerrit.server.StarredChangesUtil;
-import com.google.gerrit.server.StarredChangesUtil.IllegalLabelException;
-import com.google.gerrit.server.change.ChangeResource;
-import com.google.inject.Inject;
-import com.google.inject.Singleton;
-
-@Singleton
-public class Unignore implements RestModifyView<ChangeResource, Input>, UiAction<ChangeResource> {
- private static final FluentLogger logger = FluentLogger.forEnclosingClass();
-
- private final StarredChangesUtil stars;
-
- @Inject
- Unignore(StarredChangesUtil stars) {
- this.stars = stars;
- }
-
- @Override
- public Description getDescription(ChangeResource rsrc) {
- return new UiAction.Description()
- .setLabel("Unignore")
- .setTitle("Unignore the change")
- .setVisible(isIgnored(rsrc));
- }
-
- @Override
- public Response<String> apply(ChangeResource rsrc, Input input) throws IllegalLabelException {
- if (isIgnored(rsrc)) {
- stars.unignore(rsrc);
- }
- return Response.ok();
- }
-
- private boolean isIgnored(ChangeResource rsrc) {
- try {
- return stars.isIgnored(rsrc);
- } catch (StorageException e) {
- logger.atSevere().withCause(e).log("failed to check ignored star");
- }
- return false;
- }
-}
diff --git a/javatests/com/google/gerrit/acceptance/api/accounts/AccountIT.java b/javatests/com/google/gerrit/acceptance/api/accounts/AccountIT.java
index 9f47925..3ba8535 100644
--- a/javatests/com/google/gerrit/acceptance/api/accounts/AccountIT.java
+++ b/javatests/com/google/gerrit/acceptance/api/accounts/AccountIT.java
@@ -796,58 +796,6 @@
}
@Test
- public void ignoreChange() throws Exception {
- AccountIndexedCounter accountIndexedCounter = new AccountIndexedCounter();
- try (Registration registration =
- extensionRegistry.newRegistration().add(accountIndexedCounter)) {
- TestAccount user2 = accountCreator.user2();
- accountIndexedCounter.clear();
-
- PushOneCommit.Result r = createChange();
-
- ReviewerInput in = new ReviewerInput();
- in.reviewer = user.email();
- gApi.changes().id(r.getChangeId()).addReviewer(in);
-
- in = new ReviewerInput();
- in.reviewer = user2.email();
- gApi.changes().id(r.getChangeId()).addReviewer(in);
-
- requestScopeOperations.setApiUser(user.id());
- gApi.changes().id(r.getChangeId()).ignore(true);
-
- sender.clear();
- requestScopeOperations.setApiUser(admin.id());
- gApi.changes().id(r.getChangeId()).abandon();
- List<Message> messages = sender.getMessages();
- assertThat(messages).hasSize(1);
- assertThat(messages.get(0).rcpt()).containsExactly(user2.getNameEmail());
- accountIndexedCounter.assertNoReindex();
- }
- }
-
- @Test
- public void addReviewerToIgnoredChange() throws Exception {
- AccountIndexedCounter accountIndexedCounter = new AccountIndexedCounter();
- try (Registration registration =
- extensionRegistry.newRegistration().add(accountIndexedCounter)) {
- PushOneCommit.Result r = createChange();
-
- requestScopeOperations.setApiUser(user.id());
- gApi.changes().id(r.getChangeId()).ignore(true);
-
- sender.clear();
- requestScopeOperations.setApiUser(admin.id());
-
- ReviewerInput in = new ReviewerInput();
- in.reviewer = user.email();
- gApi.changes().id(r.getChangeId()).addReviewer(in);
- List<Message> messages = sender.getMessages();
- assertThat(messages).hasSize(0);
- }
- }
-
- @Test
public void addExistingReviewersUsingPostReview() throws Exception {
PushOneCommit.Result r = createChange();
diff --git a/javatests/com/google/gerrit/acceptance/api/change/ChangeIT.java b/javatests/com/google/gerrit/acceptance/api/change/ChangeIT.java
index 0a85ca1..33d195a 100644
--- a/javatests/com/google/gerrit/acceptance/api/change/ChangeIT.java
+++ b/javatests/com/google/gerrit/acceptance/api/change/ChangeIT.java
@@ -164,7 +164,6 @@
import com.google.gerrit.index.IndexConfig;
import com.google.gerrit.index.query.PostFilterPredicate;
import com.google.gerrit.server.ChangeMessagesUtil;
-import com.google.gerrit.server.StarredChangesUtil;
import com.google.gerrit.server.change.ChangeMessages;
import com.google.gerrit.server.change.ChangeResource;
import com.google.gerrit.server.change.testing.TestChangeETagComputation;
@@ -4666,110 +4665,6 @@
}
@Test
- public void ignore() throws Exception {
- String email = "user2@example.com";
- String fullname = "User2";
- accountOperations
- .newAccount()
- .username("user2")
- .preferredEmail(email)
- .fullname(fullname)
- .create();
-
- PushOneCommit.Result r = createChange();
-
- ReviewerInput in = new ReviewerInput();
- in.reviewer = user.email();
- gApi.changes().id(r.getChangeId()).addReviewer(in);
-
- in = new ReviewerInput();
- in.reviewer = email;
- gApi.changes().id(r.getChangeId()).addReviewer(in);
-
- requestScopeOperations.setApiUser(user.id());
- gApi.changes().id(r.getChangeId()).ignore(true);
- assertThat(gApi.changes().id(r.getChangeId()).ignored()).isTrue();
-
- // New patch set notification is not sent to users ignoring the change
- sender.clear();
- requestScopeOperations.setApiUser(admin.id());
- amendChange(r.getChangeId());
- List<Message> messages = sender.getMessages();
- assertThat(messages).hasSize(1);
- Address address = Address.create(fullname, email);
- assertThat(messages.get(0).rcpt()).containsExactly(address);
-
- // Review notification is not sent to users ignoring the change
- sender.clear();
- gApi.changes().id(r.getChangeId()).current().review(ReviewInput.approve());
- messages = sender.getMessages();
- assertThat(messages).hasSize(1);
- assertThat(messages.get(0).rcpt()).containsExactly(address);
-
- // Abandoned notification is not sent to users ignoring the change
- sender.clear();
- gApi.changes().id(r.getChangeId()).abandon();
- messages = sender.getMessages();
- assertThat(messages).hasSize(1);
- assertThat(messages.get(0).rcpt()).containsExactly(address);
-
- requestScopeOperations.setApiUser(user.id());
- gApi.changes().id(r.getChangeId()).ignore(false);
- assertThat(gApi.changes().id(r.getChangeId()).ignored()).isFalse();
- }
-
- @Test
- public void cannotIgnoreOwnChange() throws Exception {
- String changeId = createChange().getChangeId();
-
- BadRequestException thrown =
- assertThrows(BadRequestException.class, () -> gApi.changes().id(changeId).ignore(true));
- assertThat(thrown).hasMessageThat().contains("cannot ignore own change");
- }
-
- @Test
- public void cannotIgnoreStarredChange() throws Exception {
- String changeId = createChange().getChangeId();
-
- requestScopeOperations.setApiUser(user.id());
- gApi.accounts().self().starChange(changeId);
- assertThat(gApi.changes().id(changeId).get().starred).isTrue();
-
- ResourceConflictException thrown =
- assertThrows(
- ResourceConflictException.class, () -> gApi.changes().id(changeId).ignore(true));
- assertThat(thrown)
- .hasMessageThat()
- .contains(
- "The labels "
- + StarredChangesUtil.DEFAULT_LABEL
- + " and "
- + StarredChangesUtil.IGNORE_LABEL
- + " are mutually exclusive. Only one of them can be set.");
- }
-
- @Test
- public void cannotStarIgnoredChange() throws Exception {
- String changeId = createChange().getChangeId();
-
- requestScopeOperations.setApiUser(user.id());
- gApi.changes().id(changeId).ignore(true);
- assertThat(gApi.changes().id(changeId).ignored()).isTrue();
-
- ResourceConflictException thrown =
- assertThrows(
- ResourceConflictException.class, () -> gApi.accounts().self().starChange(changeId));
- assertThat(thrown)
- .hasMessageThat()
- .contains(
- "The labels "
- + StarredChangesUtil.DEFAULT_LABEL
- + " and "
- + StarredChangesUtil.IGNORE_LABEL
- + " are mutually exclusive. Only one of them can be set.");
- }
-
- @Test
public void changeDetailsDoesNotRequireIndex() throws Exception {
// This set of options must be kept in sync with gr-rest-api-interface.js
Set<ListChangesOption> options =
diff --git a/javatests/com/google/gerrit/acceptance/rest/binding/ChangesRestApiBindingsIT.java b/javatests/com/google/gerrit/acceptance/rest/binding/ChangesRestApiBindingsIT.java
index cb795a9..2d663df 100644
--- a/javatests/com/google/gerrit/acceptance/rest/binding/ChangesRestApiBindingsIT.java
+++ b/javatests/com/google/gerrit/acceptance/rest/binding/ChangesRestApiBindingsIT.java
@@ -74,8 +74,6 @@
RestCall.delete("/changes/%s/private"),
RestCall.post("/changes/%s/wip"),
RestCall.post("/changes/%s/ready"),
- RestCall.put("/changes/%s/ignore"),
- RestCall.put("/changes/%s/unignore"),
RestCall.get("/changes/%s/messages"),
RestCall.put("/changes/%s/message"),
RestCall.post("/changes/%s/merge"),
diff --git a/javatests/com/google/gerrit/acceptance/server/mail/ChangeNotificationsIT.java b/javatests/com/google/gerrit/acceptance/server/mail/ChangeNotificationsIT.java
index b94996c..7603aec 100644
--- a/javatests/com/google/gerrit/acceptance/server/mail/ChangeNotificationsIT.java
+++ b/javatests/com/google/gerrit/acceptance/server/mail/ChangeNotificationsIT.java
@@ -304,32 +304,6 @@
addReviewerToReviewableChange(batch());
}
- private void addReviewerToIgnoredChange(Adder adder) throws Exception {
- StagedChange sc = stageReviewableChange();
- requestScopeOperations.setApiUser(sc.reviewer.id());
- gApi.changes().id(sc.changeId).ignore(true);
- TestAccount addedReviewer = accountCreator.create("added", "added@example.com", "added", null);
- addReviewer(adder, sc.changeId, sc.owner, addedReviewer.email(), CC_ON_OWN_COMMENTS, null);
-
- assertThat(sender)
- .sent("newchange", sc)
- .to(addedReviewer)
- .cc(sc.owner)
- .cc(StagedUsers.REVIEWER_BY_EMAIL, StagedUsers.CC_BY_EMAIL)
- .noOneElse();
- assertThat(sender).didNotSend();
- }
-
- @Test
- public void addReviewerToIgnoredChangeSingly() throws Exception {
- addReviewerToIgnoredChange(singly());
- }
-
- @Test
- public void addReviewerToIgnoredChangeBatch() throws Exception {
- addReviewerToIgnoredChange(batch());
- }
-
private void addReviewerToReviewableChangeByOwnerCcingSelf(Adder adder) throws Exception {
StagedChange sc = stageReviewableChange();
TestAccount reviewer = accountCreator.create("added", "added@example.com", "added", null);
diff --git a/javatests/com/google/gerrit/acceptance/server/project/ProjectWatchIT.java b/javatests/com/google/gerrit/acceptance/server/project/ProjectWatchIT.java
index d911512..1900158 100644
--- a/javatests/com/google/gerrit/acceptance/server/project/ProjectWatchIT.java
+++ b/javatests/com/google/gerrit/acceptance/server/project/ProjectWatchIT.java
@@ -461,39 +461,6 @@
}
@Test
- public void watchProjectNoNotificationForIgnoredChange() throws Exception {
- // watch project
- String watchedProject = projectOperations.newProject().create().get();
- requestScopeOperations.setApiUser(user.id());
- watch(watchedProject);
-
- // push a change to watched project
- requestScopeOperations.setApiUser(admin.id());
- TestRepository<InMemoryRepository> watchedRepo =
- cloneProject(Project.nameKey(watchedProject), admin);
- PushOneCommit.Result r =
- pushFactory
- .create(admin.newIdent(), watchedRepo, "ignored change", "a", "a1")
- .to("refs/for/master");
- r.assertOkStatus();
-
- // ignore the change
- requestScopeOperations.setApiUser(user.id());
- gApi.changes().id(r.getChangeId()).ignore(true);
-
- sender.clear();
-
- // post a comment -> should not trigger email notification since user ignored the change
- requestScopeOperations.setApiUser(admin.id());
- ReviewInput in = new ReviewInput();
- in.message = "comment";
- gApi.changes().id(r.getChangeId()).current().review(in);
-
- // assert email notification
- assertThat(sender.getMessages()).isEmpty();
- }
-
- @Test
public void watchProjectNoNotificationForPrivateChange() throws Exception {
// watch project
String watchedProject = projectOperations.newProject().create().get();
diff --git a/javatests/com/google/gerrit/server/query/change/AbstractQueryChangesTest.java b/javatests/com/google/gerrit/server/query/change/AbstractQueryChangesTest.java
index 9259c99..4795185 100644
--- a/javatests/com/google/gerrit/server/query/change/AbstractQueryChangesTest.java
+++ b/javatests/com/google/gerrit/server/query/change/AbstractQueryChangesTest.java
@@ -102,7 +102,6 @@
import com.google.gerrit.server.IdentifiedUser;
import com.google.gerrit.server.PatchSetUtil;
import com.google.gerrit.server.ServerInitiated;
-import com.google.gerrit.server.StarredChangesUtil;
import com.google.gerrit.server.account.AccountCache;
import com.google.gerrit.server.account.AccountManager;
import com.google.gerrit.server.account.Accounts;
@@ -2675,11 +2674,9 @@
accountManager.authenticate(authRequestFactory.createForUser("anotheruser")).getAccountId();
assertQuery("has:star", change2, change1);
- assertQuery("star:star", change2, change1);
requestContext.setContext(newRequestContext(user2));
assertQuery("has:star");
- assertQuery("star:star");
}
@Test
@@ -2710,7 +2707,6 @@
// check default star
assertQuery("has:star", change1);
assertQuery("is:starred", change1);
- assertQuery("star:" + StarredChangesUtil.DEFAULT_LABEL, change1);
}
public void byStarWithManyStars_starsComputedFromIndex() throws Exception {
@@ -3937,7 +3933,7 @@
@Test
public void selfFailsForAnonymousUser() throws Exception {
- for (String query : ImmutableList.of("assignee:self", "has:star", "is:starred", "star:star")) {
+ for (String query : ImmutableList.of("assignee:self", "has:star", "is:starred")) {
assertQuery(query);
RequestContext oldContext = requestContext.setContext(anonymousUserProvider::get);