Add field for wip changes to index and QueryBuilder
The reviewer predicate was amended to exclude wip changes. This is needed to take wip changes down from reviewers dashboards that use this search predicate to present changes for review. Change-Id: I9612759c0437188c22a6aceba72c367b51e09876
This commit is contained in:
parent
001281ee1f
commit
6cfcb37ee5
@ -378,6 +378,11 @@ is:private::
|
||||
True if the change is private, ie. only visible to owner and its
|
||||
reviewers.
|
||||
|
||||
[[workInProgress]]
|
||||
is:wip::
|
||||
+
|
||||
True if the change is Work In Progress.
|
||||
|
||||
[[status]]
|
||||
status:open, status:pending::
|
||||
+
|
||||
|
@ -137,6 +137,7 @@ public class SearchSuggestOracle extends HighlightSuggestOracle {
|
||||
suggestions.add("is:abandoned");
|
||||
suggestions.add("is:mergeable");
|
||||
suggestions.add("is:ignored");
|
||||
suggestions.add("is:wip");
|
||||
|
||||
suggestions.add("status:");
|
||||
suggestions.add("status:open");
|
||||
|
@ -428,6 +428,10 @@ public class ChangeField {
|
||||
public static final FieldDef<ChangeData, String> PRIVATE =
|
||||
exact(ChangeQueryBuilder.FIELD_PRIVATE).build(cd -> cd.change().isPrivate() ? "1" : "0");
|
||||
|
||||
/** Determines if this change is work in progress. */
|
||||
public static final FieldDef<ChangeData, String> WIP =
|
||||
exact(ChangeQueryBuilder.FIELD_WIP).build(cd -> cd.change().isWorkInProgress() ? "1" : "0");
|
||||
|
||||
/** Users who have commented on this change. */
|
||||
public static final FieldDef<ChangeData, Iterable<Integer>> COMMENTBY =
|
||||
integer(ChangeQueryBuilder.FIELD_COMMENTBY)
|
||||
|
@ -71,8 +71,9 @@ public class ChangeSchemaDefinitions extends SchemaDefinitions<ChangeData> {
|
||||
ChangeField.UPDATED);
|
||||
|
||||
@Deprecated static final Schema<ChangeData> V40 = schema(V39, ChangeField.PRIVATE);
|
||||
@Deprecated static final Schema<ChangeData> V41 = schema(V40, ChangeField.REVIEWER_BY_EMAIL);
|
||||
|
||||
static final Schema<ChangeData> V41 = schema(V40, ChangeField.REVIEWER_BY_EMAIL);
|
||||
static final Schema<ChangeData> V42 = schema(V41, ChangeField.WIP);
|
||||
|
||||
public static final String NAME = "changes";
|
||||
public static final ChangeSchemaDefinitions INSTANCE = new ChangeSchemaDefinitions();
|
||||
|
@ -168,6 +168,7 @@ public class ChangeQueryBuilder extends QueryBuilder<ChangeData> {
|
||||
public static final String FIELD_UNRESOLVED_COMMENT_COUNT = "unresolved";
|
||||
public static final String FIELD_VISIBLETO = "visibleto";
|
||||
public static final String FIELD_WATCHEDBY = "watchedby";
|
||||
public static final String FIELD_WIP = "wip";
|
||||
|
||||
public static final String ARG_ID_USER = "user";
|
||||
public static final String ARG_ID_GROUP = "group";
|
||||
@ -571,7 +572,9 @@ public class ChangeQueryBuilder extends QueryBuilder<ChangeData> {
|
||||
}
|
||||
|
||||
if ("reviewer".equalsIgnoreCase(value)) {
|
||||
return ReviewerPredicate.reviewer(args, self());
|
||||
return Predicate.and(
|
||||
Predicate.not(new BooleanPredicate(ChangeField.WIP, args.fillArgs)),
|
||||
ReviewerPredicate.reviewer(args, self()));
|
||||
}
|
||||
|
||||
if ("cc".equalsIgnoreCase(value)) {
|
||||
@ -602,6 +605,10 @@ public class ChangeQueryBuilder extends QueryBuilder<ChangeData> {
|
||||
return star("ignore");
|
||||
}
|
||||
|
||||
if ("wip".equalsIgnoreCase(value)) {
|
||||
return new BooleanPredicate(ChangeField.WIP, args.fillArgs);
|
||||
}
|
||||
|
||||
try {
|
||||
return status(value);
|
||||
} catch (IllegalArgumentException e) {
|
||||
@ -955,7 +962,9 @@ public class ChangeQueryBuilder extends QueryBuilder<ChangeData> {
|
||||
|
||||
@Operator
|
||||
public Predicate<ChangeData> reviewer(String who) throws QueryParseException, OrmException {
|
||||
return reviewerByState(who, ReviewerStateInternal.REVIEWER);
|
||||
return Predicate.and(
|
||||
Predicate.not(new BooleanPredicate(ChangeField.WIP, args.fillArgs)),
|
||||
reviewerByState(who, ReviewerStateInternal.REVIEWER));
|
||||
}
|
||||
|
||||
@Operator
|
||||
|
Loading…
Reference in New Issue
Block a user