]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-19147 Fix assigned_to_me facet
authorDimitris Kavvathas <dimitris.kavvathas@sonarsource.com>
Fri, 12 May 2023 13:10:06 +0000 (15:10 +0200)
committersonartech <sonartech@sonarsource.com>
Fri, 12 May 2023 20:02:41 +0000 (20:02 +0000)
server/sonar-webserver-es/src/main/java/org/sonar/server/issue/index/IssueIndex.java
server/sonar-webserver-webapi/src/it/java/org/sonar/server/issue/ws/SearchActionIT.java

index faa16c76147fcbf7e31caec2ff43355fcf6af6d1..1cc371ca21bd9e6d8a61002836f109f1dfcd6170 100644 (file)
@@ -970,10 +970,9 @@ public class IssueIndex {
   private void addAssignedToMeFacetIfNeeded(SearchOptions options, TopAggregationHelper aggregationHelper, SearchSourceBuilder esRequest) {
     String uuid = userSession.getUuid();
     if (options.getFacets().contains(ASSIGNED_TO_ME.getName()) && !StringUtils.isEmpty(uuid)) {
-      AggregationBuilder aggregation = aggregationHelper.buildTermTopAggregation(
+      AggregationBuilder aggregation = aggregationHelper.buildTopAggregation(
         ASSIGNED_TO_ME.getName(),
         ASSIGNED_TO_ME.getTopAggregationDef(),
-        ASSIGNED_TO_ME.getNumberOfTerms(),
         NO_EXTRA_FILTER,
         t ->
           // add sub-aggregation to return issue count for current user
index e93f2df7b00fb0d7a4769f9b77cb1e269e420989..feb7555d0a07f4a30c6de772dcbd10bb32ab7c96 100644 (file)
@@ -594,8 +594,8 @@ public class SearchActionIT {
 
   @Test
   public void filter_by_assigned_to_me() {
-    UserDto john = db.users().insertUser(u -> u.setLogin("john").setName("John").setEmail("john@email.com"));
     UserDto alice = db.users().insertUser(u -> u.setLogin("alice").setName("Alice").setEmail("alice@email.com"));
+    UserDto john = db.users().insertUser(u -> u.setLogin("john").setName("John").setEmail("john@email.com"));
     ComponentDto project = db.components().insertPublicProject(c -> c.setUuid("PROJECT_ID").setKey("PROJECT_KEY").setBranchUuid("PROJECT_ID")).getMainBranchComponent();
     indexPermissions();
     ComponentDto file = db.components().insertComponent(newFileDto(project, null, "FILE_ID").setKey("FILE_KEY"));
@@ -827,10 +827,10 @@ public class SearchActionIT {
 
   @Test
   public void filter_by_assigned_to_me_when_not_authenticate() {
-    UserDto poy = db.users().insertUser(u -> u.setLogin("poy").setName("poypoy").setEmail("poypoy@email.com"));
-    userSession.logIn(poy);
     UserDto alice = db.users().insertUser(u -> u.setLogin("alice").setName("Alice").setEmail("alice@email.com"));
     UserDto john = db.users().insertUser(u -> u.setLogin("john").setName("John").setEmail("john@email.com"));
+    UserDto poy = db.users().insertUser(u -> u.setLogin("poy").setName("poypoy").setEmail("poypoy@email.com"));
+    userSession.logIn(poy);
     ComponentDto project = db.components().insertPublicProject("PROJECT_ID", c -> c.setKey("PROJECT_KEY")).getMainBranchComponent();
     indexPermissions();
     ComponentDto file = db.components().insertComponent(newFileDto(project, null, "FILE_ID").setKey("FILE_KEY"));