Fix #15231: Glossary tasks is not showing on landing page to reviewer (#15340)

This commit is contained in:
Sriharsha Chintalapani 2024-02-25 23:13:11 -08:00 committed by GitHub
parent 50034400ee
commit cd251ea387
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 11 deletions

View File

@ -977,7 +977,7 @@ public interface CollectionDAO {
@ConnectionAwareSqlQuery( @ConnectionAwareSqlQuery(
value = value =
"SELECT json FROM thread_entity <condition> AND " "SELECT json FROM thread_entity <condition> AND "
+ "JSON_OVERLAPS(taskAssignees, :userTeamJsonMysql) " + "JSON_OVERLAPS(json_extract(taskAssignees, '$[*].id'), :userTeamJsonMysql) "
+ "ORDER BY createdAt DESC " + "ORDER BY createdAt DESC "
+ "LIMIT :limit", + "LIMIT :limit",
connectionType = MYSQL) connectionType = MYSQL)
@ -995,7 +995,7 @@ public interface CollectionDAO {
@ConnectionAwareSqlQuery( @ConnectionAwareSqlQuery(
value = value =
"SELECT count(id) FROM thread_entity <condition> AND " "SELECT count(id) FROM thread_entity <condition> AND "
+ "JSON_OVERLAPS(taskAssignees, :userTeamJsonMysql) ", + "JSON_OVERLAPS(json_extract(taskAssignees, '$[*].id'), :userTeamJsonMysql) ",
connectionType = MYSQL) connectionType = MYSQL)
int listCountTasksAssignedTo( int listCountTasksAssignedTo(
@BindList("userTeamJsonPostgres") List<String> userTeamJsonPostgres, @BindList("userTeamJsonPostgres") List<String> userTeamJsonPostgres,
@ -1012,7 +1012,7 @@ public interface CollectionDAO {
@ConnectionAwareSqlQuery( @ConnectionAwareSqlQuery(
value = value =
"SELECT json FROM thread_entity <condition> " "SELECT json FROM thread_entity <condition> "
+ "AND (JSON_OVERLAPS(taskAssignees, :userTeamJsonMysql) OR createdBy = :username) " + "AND (JSON_OVERLAPS(JSON_EXTRACT(taskAssignees, '$[*].id'), :userTeamJsonMysql) OR createdBy = :username) "
+ "ORDER BY createdAt DESC " + "ORDER BY createdAt DESC "
+ "LIMIT :limit", + "LIMIT :limit",
connectionType = MYSQL) connectionType = MYSQL)
@ -1031,7 +1031,7 @@ public interface CollectionDAO {
@ConnectionAwareSqlQuery( @ConnectionAwareSqlQuery(
value = value =
"SELECT count(id) FROM thread_entity <condition> " "SELECT count(id) FROM thread_entity <condition> "
+ "AND (JSON_OVERLAPS(taskAssignees, :userTeamJsonMysql) OR createdBy = :username) ", + "AND (JSON_OVERLAPS(JSON_EXTRACT(taskAssignees, '$[*].id'), :userTeamJsonMysql) OR createdBy = :username) ",
connectionType = MYSQL) connectionType = MYSQL)
int listCountTasksOfUser( int listCountTasksOfUser(
@BindList("userTeamJsonPostgres") List<String> userTeamJsonPostgres, @BindList("userTeamJsonPostgres") List<String> userTeamJsonPostgres,
@ -1210,8 +1210,8 @@ public interface CollectionDAO {
+ "id in (SELECT toId FROM entity_relationship WHERE (fromEntity='user' AND fromId= :userId AND toEntity='THREAD' AND relation IN (1,2))) " + "id in (SELECT toId FROM entity_relationship WHERE (fromEntity='user' AND fromId= :userId AND toEntity='THREAD' AND relation IN (1,2))) "
+ " OR id in (SELECT toId FROM entity_relationship WHERE ((fromEntity='user' AND fromId= :userId) OR " + " OR id in (SELECT toId FROM entity_relationship WHERE ((fromEntity='user' AND fromId= :userId) OR "
+ "(fromEntity='team' AND fromId IN (<teamIds>))) AND relation=11)) OR " + "(fromEntity='team' AND fromId IN (<teamIds>))) AND relation=11)) OR "
+ "(JSON_OVERLAPS(taskAssignees, :userTeamJsonMysql) OR createdBy = :username)" + "(JSON_OVERLAPS(JSON_EXTRACT(taskAssignees, '$[*].id'), :userTeamJsonMysql) OR createdBy = :username)"
+ "GROUP BY te.type, te.taskStatus", + " GROUP BY te.type, te.taskStatus",
connectionType = MYSQL) connectionType = MYSQL)
@RegisterRowMapper(OwnerCountFieldMapper.class) @RegisterRowMapper(OwnerCountFieldMapper.class)
List<List<String>> listCountByOwner( List<List<String>> listCountByOwner(

View File

@ -965,12 +965,9 @@ public class FeedRepository {
} }
private String getUserTeamJsonMysql(UUID userId, List<String> teamIds) { private String getUserTeamJsonMysql(UUID userId, List<String> teamIds) {
// Build a string like this for the tasks filter
// [{"id":"9e78b924-b75c-4141-9845-1b3eb81fdc1b","type":"team"},{"id":"fe21e1ba-ce00-49fa-8b62-3c9a6669a11b","type":"user"}]
List<String> result = new ArrayList<>(); List<String> result = new ArrayList<>();
JSONObject json = getUserTeamJson(userId, "user"); result.add("\"" + userId.toString() + "\"");
result.add(json.toString()); teamIds.forEach(id -> result.add("\"" + id + "\""));
teamIds.forEach(id -> result.add(getUserTeamJson(id, "team").toString()));
return result.toString(); return result.toString();
} }