Merge branch 'stable-2.14' into stable-2.15

* stable-2.14:
  Fix star icon not highlighted in change list on UI
  Fix the "red" change size on elasticsearch site UI

Change-Id: Id1336e9162363e98ab013603a451efe96472c2c6
This commit is contained in:
David Pursehouse
2018-04-12 09:03:07 +09:00

View File

@@ -27,7 +27,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.index.QueryOptions;
@@ -298,9 +300,23 @@ class ElasticChangeIndex extends AbstractElasticIndex<Change.Id, ChangeData>
// Changed lines.
int added = addedElement.getAsInt();
int deleted = deletedElement.getAsInt();
if (added != 0 && deleted != 0) {
cd.setChangedLines(added, deleted);
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.