Resurrect assignee icons on the issue list (#3136)

This commit is contained in:
Naoki Takezoe
2022-09-13 23:19:38 +09:00
committed by GitHub
parent f13c10859f
commit 3a2908c3a3
5 changed files with 28 additions and 30 deletions

View File

@@ -45,7 +45,7 @@ trait PrioritiesControllerBase extends ControllerBase {
get("/:owner/:repository/issues/priorities")(referrersOnly { repository =>
html.list(
getPriorities(repository.owner, repository.name),
countIssueGroupByPriorities(repository.owner, repository.name, IssuesService.IssueSearchCondition(), Map.empty),
countIssueGroupByPriorities(repository.owner, repository.name, IssuesService.IssueSearchCondition()),
repository,
hasDeveloperRole(repository.owner, repository.name, context.loginAccount)
)
@@ -60,7 +60,7 @@ trait PrioritiesControllerBase extends ControllerBase {
createPriority(repository.owner, repository.name, form.priorityName, form.description, form.color.substring(1))
html.priority(
getPriority(repository.owner, repository.name, priorityId).get,
countIssueGroupByPriorities(repository.owner, repository.name, IssuesService.IssueSearchCondition(), Map.empty),
countIssueGroupByPriorities(repository.owner, repository.name, IssuesService.IssueSearchCondition()),
repository,
hasDeveloperRole(repository.owner, repository.name, context.loginAccount)
)
@@ -84,7 +84,7 @@ trait PrioritiesControllerBase extends ControllerBase {
)
html.priority(
getPriority(repository.owner, repository.name, params("priorityId").toInt).get,
countIssueGroupByPriorities(repository.owner, repository.name, IssuesService.IssueSearchCondition(), Map.empty),
countIssueGroupByPriorities(repository.owner, repository.name, IssuesService.IssueSearchCondition()),
repository,
hasDeveloperRole(repository.owner, repository.name, context.loginAccount)
)

View File

@@ -147,7 +147,7 @@ trait IssuesService {
t3.labelName
}
.map {
case labelName ~ t =>
case (labelName, t) =>
labelName -> t.length
}
.list
@@ -165,8 +165,7 @@ trait IssuesService {
def countIssueGroupByPriorities(
owner: String,
repository: String,
condition: IssueSearchCondition,
filterUser: Map[String, String]
condition: IssueSearchCondition
)(implicit s: Session): Map[String, Int] = {
searchIssueQuery(Seq(owner -> repository), condition.copy(labels = Set.empty), IssueSearchOption.Issues)
@@ -180,7 +179,7 @@ trait IssuesService {
t2.priorityName
}
.map {
case priorityName ~ t =>
case (priorityName, t) =>
priorityName -> t.length
}
.list
@@ -216,9 +215,11 @@ trait IssuesService {
.on { case t1 ~ t2 ~ i ~ t3 ~ t4 ~ t5 ~ t6 => t1.byPriority(t6.userName, t6.repositoryName, t6.priorityId) }
.joinLeft(PullRequests)
.on { case t1 ~ t2 ~ i ~ t3 ~ t4 ~ t5 ~ t6 ~ t7 => t1.byIssue(t7.userName, t7.repositoryName, t7.issueId) }
.sortBy { case t1 ~ t2 ~ i ~ t3 ~ t4 ~ t5 ~ t6 ~ t7 => i asc }
.joinLeft(IssueAssignees)
.on { case t1 ~ t2 ~ i ~ t3 ~ t4 ~ t5 ~ t6 ~ t7 ~ t8 => t1.byIssue(t8.userName, t8.repositoryName, t8.issueId) }
.sortBy { case t1 ~ t2 ~ i ~ t3 ~ t4 ~ t5 ~ t6 ~ t7 ~ t8 => i asc }
.map {
case t1 ~ t2 ~ i ~ t3 ~ t4 ~ t5 ~ t6 ~ t7 =>
case t1 ~ t2 ~ i ~ t3 ~ t4 ~ t5 ~ t6 ~ t7 ~ t8 =>
(
t1,
t2.commentCount,
@@ -227,7 +228,8 @@ trait IssuesService {
t4.map(_.color),
t5.map(_.title),
t6.map(_.priorityName),
t7.map(_.commitIdTo)
t7.map(_.commitIdTo),
t8.map(_.assigneeUserName)
)
}
.list
@@ -237,7 +239,7 @@ trait IssuesService {
result.map { issues =>
issues.head match {
case (issue, commentCount, _, _, _, milestone, priority, commitId) =>
case (issue, commentCount, _, _, _, milestone, priority, commitId, _) =>
IssueInfo(
issue,
issues.flatMap { t =>
@@ -246,7 +248,8 @@ trait IssuesService {
milestone,
priority,
commentCount,
commitId
commitId,
issues.flatMap(_._9)
)
}
} toList
@@ -270,7 +273,7 @@ trait IssuesService {
.map { case t1 ~ t2 ~ i ~ t3 ~ t4 ~ t5 => (t1, t3, t5) }
.list
.groupBy {
case (issue, account, assignedUsers) =>
case (issue, account, _) =>
(issue, account)
}
.map {
@@ -748,12 +751,12 @@ trait IssuesService {
s: Session
): Int = {
Issues.filter(_.byPrimaryKey(owner, repository, issueId)).map(_.updatedDate).update(currentDate)
IssueComments.filter(_.byPrimaryKey(commentId)).firstOption match {
case Some(c) if c.action == "reopen_comment" =>
IssueComments.filter(_.byPrimaryKey(commentId)).first match {
case c if c.action == "reopen_comment" =>
IssueComments.filter(_.byPrimaryKey(commentId)).map(t => (t.content, t.action)).update("Reopen", "reopen")
case Some(c) if c.action == "close_comment" =>
case c if c.action == "close_comment" =>
IssueComments.filter(_.byPrimaryKey(commentId)).map(t => (t.content, t.action)).update("Close", "close")
case Some(_) =>
case _ =>
IssueComments.filter(_.byPrimaryKey(commentId)).delete
IssueComments insert IssueComment(
userName = owner,
@@ -1084,7 +1087,8 @@ object IssuesService {
milestone: Option[String],
priority: Option[String],
commentCount: Int,
commitId: Option[String]
commitId: Option[String],
assignees: Seq[String]
)
}

View File

@@ -17,7 +17,7 @@
</tr>
</thead>
<tbody>
@issues.map { case (IssueInfo(issue, labels, milestone, priority, commentCount, commitId), status) =>
@issues.map { case (IssueInfo(issue, labels, milestone, priority, commentCount, commitId, assignedUserNames), status) =>
<tr>
<td style="padding-top: 12px; padding-bottom: 12px;">
<a href="@context.path/@issue.userName/@issue.repositoryName">@issue.userName/@issue.repositoryName</a>&nbsp;&#xFF65;
@@ -33,11 +33,9 @@
<span class="label-color small" style="background-color: #@label.color; color: #@label.fontColor; padding-left: 4px; padding-right: 4px">@label.labelName</span>
}
<span class="pull-right muted">
@*
@issue.assignedUserName.map { userName =>
@assignedUserNames.map { userName =>
@helpers.avatar(userName, 20, tooltip = true)
}
*@
@if(commentCount > 0){
<a href="@context.path/@issue.userName/@issue.repositoryName/issues/@issue.issueId" class="issue-comment-count">
<i class="octicon octicon-comment active"></i> @commentCount

View File

@@ -206,7 +206,7 @@
</td>
</tr>
}
@issues.map { case (IssueInfo(issue, labels, milestone, priority, commentCount, commitId), status) =>
@issues.map { case (IssueInfo(issue, labels, milestone, priority, commentCount, commitId, assignedUserNames), status) =>
<tr>
<td style="padding-top: 12px; padding-bottom: 12px;">
@if(isManageable){
@@ -230,11 +230,9 @@
<span class="label-color small" style="background-color: #@label.color; color: #@label.fontColor; padding-left: 4px; padding-right: 4px">@label.labelName</span>
}
<span class="pull-right small">
@*
@issue.assignedUserName.map { userName =>
@assignedUserNames.map { userName =>
@helpers.avatar(userName, 20, tooltip = true)
}
*@
@if(commentCount > 0){
<a href="@context.path/@issue.userName/@issue.repositoryName/issues/@issue.issueId" class="issue-comment-count">
<i class="octicon octicon-comment active"></i> @commentCount

View File

@@ -62,7 +62,7 @@
</td>
</tr>
}
@issues.map { case (IssueInfo(issue, labels, milestone, priority, commentCount, commitId), status) =>
@issues.map { case (IssueInfo(issue, labels, milestone, priority, commentCount, commitId, assignedUserNames), status) =>
<tr>
<td style="padding-top: 12px; padding-bottom: 12px;">
@if(isManageable){
@@ -90,11 +90,9 @@
<span class="label-color small" style="background-color: #@label.color; color: #@label.fontColor; padding-left: 4px; padding-right: 4px">@label.labelName</span>
}
<span class="pull-right small">
@*
@issue.assignedUserName.map { userName =>
@assignedUserNames.map { userName =>
@helpers.avatar(userName, 20, tooltip = true)
}
*@
@if(commentCount > 0){
<a href="@context.path/@issue.userName/@issue.repositoryName/issues/@issue.issueId" class="issue-comment-count">
<i class="octicon octicon-comment active"></i> @commentCount