Fix star icon not highlighted in change list on UI
The star icon for the starred changes did not show up as such in the change list because the 'star' field for the change index was not handled. This change adds the settings for the 'star' field of the change so that all the starred changes can be seen highlighted in the change list. Bug: Issue 8588 Change-Id: I6682e1ed009e9c3b2518d1260f66cddd91dcaa31
This commit is contained in:
parent
ebda572961
commit
4c28986103
@ -26,7 +26,9 @@ import com.google.common.collect.FluentIterable;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.ListMultimap;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.MultimapBuilder;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.google.gerrit.elasticsearch.ElasticMapping.MappingProperties;
|
||||
import com.google.gerrit.reviewdb.client.Account;
|
||||
@ -303,6 +305,22 @@ class ElasticChangeIndex extends AbstractElasticIndex<Change.Id, ChangeData>
|
||||
cd.setChangedLines(added, deleted);
|
||||
}
|
||||
|
||||
// Star.
|
||||
JsonElement starredElement = source.get(ChangeField.STAR.getName());
|
||||
if (starredElement != null) {
|
||||
ListMultimap<Account.Id, String> stars =
|
||||
MultimapBuilder.hashKeys().arrayListValues().build();
|
||||
JsonArray starBy = starredElement.getAsJsonArray();
|
||||
if (starBy.size() > 0) {
|
||||
for (int i = 0; i < starBy.size(); i++) {
|
||||
String[] indexableFields = starBy.get(i).getAsString().split(":");
|
||||
Account.Id id = Account.Id.parse(indexableFields[0]);
|
||||
stars.put(id, indexableFields[1]);
|
||||
}
|
||||
}
|
||||
cd.setStars(stars);
|
||||
}
|
||||
|
||||
// Mergeable.
|
||||
JsonElement mergeableElement = source.get(ChangeField.MERGEABLE.getName());
|
||||
if (mergeableElement != null) {
|
||||
|
Loading…
Reference in New Issue
Block a user