Changescreen: topic link to exclude abandoned changes

This change makes the topic link behavior similar to the behavior
branch link, which only shows the same status of changes for the
target branch. However when querying for new changes, it is also
useful to see what has already been done in the given topic. When
looking searching for changes of the same topic from a merged change
it is also useful to see what is still pending.

So in case of {NEW, MERGED} changes we search for both states.

Change-Id: I86f091d6afefbb4bef8bd24245edb64bb9a16f53
This commit is contained in:
Stefan Beller 2016-06-16 09:54:59 -07:00
parent db2a61d182
commit b4b9b54767
2 changed files with 17 additions and 4 deletions

View File

@ -124,6 +124,20 @@ public class PageLinks {
return status(status) + " " + op("project", proj.get());
}
public static String topicQuery(Status status, String topic) {
switch (status) {
case ABANDONED:
return toChangeQuery(status(status) + " " + op("topic", topic));
case DRAFT:
case MERGED:
case NEW:
return toChangeQuery(op("topic", topic) + " or(" +
status(Status.NEW) + " " +
status(Status.MERGED) + ")");
}
return toChangeQuery(status(status) + " " + op("topic", topic));
}
public static String toGroup(AccountGroup.UUID uuid) {
return ADMIN_GROUPS + "uuid-" + uuid;
}

View File

@ -83,10 +83,9 @@ class Topic extends Composite {
private void initTopicLink(ChangeInfo info) {
if (info.topic() != null && !info.topic().isEmpty()) {
text.setText(info.topic());
text.setTargetHistoryToken(
PageLinks.toChangeQuery(
PageLinks.op("topic", info.topic())));
String topic = info.topic();
text.setText(topic);
text.setTargetHistoryToken(PageLinks.topicQuery(info.status(), topic));
}
}