mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-10 07:25:50 +01:00
(refs #1172)Fix: Some of issue filters has been impossible to turn off
This commit is contained in:
@@ -83,7 +83,7 @@ trait DashboardControllerBase extends ControllerBase {
|
|||||||
} else session.getAs[IssueSearchCondition](key).getOrElse(IssueSearchCondition()))
|
} else session.getAs[IssueSearchCondition](key).getOrElse(IssueSearchCondition()))
|
||||||
|
|
||||||
filter match {
|
filter match {
|
||||||
case "assigned" => condition.copy(assigned = Some(userName), author = None , mentioned = None)
|
case "assigned" => condition.copy(assigned = Some(Some(userName)), author = None, mentioned = None)
|
||||||
case "mentioned" => condition.copy(assigned = None, author = None, mentioned = Some(userName))
|
case "mentioned" => condition.copy(assigned = None, author = None, mentioned = Some(userName))
|
||||||
case _ => condition.copy(assigned = None, author = Some(userName), mentioned = None)
|
case _ => condition.copy(assigned = None, author = Some(userName), mentioned = None)
|
||||||
}
|
}
|
||||||
@@ -103,7 +103,7 @@ trait DashboardControllerBase extends ControllerBase {
|
|||||||
countIssue(condition.copy(state = "open" ), false, userRepos: _*),
|
countIssue(condition.copy(state = "open" ), false, userRepos: _*),
|
||||||
countIssue(condition.copy(state = "closed"), false, userRepos: _*),
|
countIssue(condition.copy(state = "closed"), false, userRepos: _*),
|
||||||
filter match {
|
filter match {
|
||||||
case "assigned" => condition.copy(assigned = Some(userName))
|
case "assigned" => condition.copy(assigned = Some(Some(userName)))
|
||||||
case "mentioned" => condition.copy(mentioned = Some(userName))
|
case "mentioned" => condition.copy(mentioned = Some(userName))
|
||||||
case _ => condition.copy(author = Some(userName))
|
case _ => condition.copy(author = Some(userName))
|
||||||
},
|
},
|
||||||
@@ -128,7 +128,7 @@ trait DashboardControllerBase extends ControllerBase {
|
|||||||
countIssue(condition.copy(state = "open" ), true, allRepos: _*),
|
countIssue(condition.copy(state = "open" ), true, allRepos: _*),
|
||||||
countIssue(condition.copy(state = "closed"), true, allRepos: _*),
|
countIssue(condition.copy(state = "closed"), true, allRepos: _*),
|
||||||
filter match {
|
filter match {
|
||||||
case "assigned" => condition.copy(assigned = Some(userName))
|
case "assigned" => condition.copy(assigned = Some(Some(userName)))
|
||||||
case "mentioned" => condition.copy(mentioned = Some(userName))
|
case "mentioned" => condition.copy(mentioned = Some(userName))
|
||||||
case _ => condition.copy(author = Some(userName))
|
case _ => condition.copy(author = Some(userName))
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -234,9 +234,8 @@ trait IssuesService {
|
|||||||
.map { case (owner, repository) => t1.byRepository(owner, repository) }
|
.map { case (owner, repository) => t1.byRepository(owner, repository) }
|
||||||
.foldLeft[Column[Boolean]](false) ( _ || _ ) &&
|
.foldLeft[Column[Boolean]](false) ( _ || _ ) &&
|
||||||
(t1.closed === (condition.state == "closed").bind) &&
|
(t1.closed === (condition.state == "closed").bind) &&
|
||||||
//(t1.milestoneId === condition.milestoneId.get.get.bind, condition.milestoneId.flatten.isDefined) &&
|
|
||||||
(t1.milestoneId.? isEmpty, condition.milestone == Some(None)) &&
|
(t1.milestoneId.? isEmpty, condition.milestone == Some(None)) &&
|
||||||
(t1.assignedUserName === condition.assigned.get.bind, condition.assigned.isDefined) &&
|
(t1.assignedUserName.? isEmpty, condition.assigned == Some(None)) &&
|
||||||
(t1.openedUserName === condition.author.get.bind, condition.author.isDefined) &&
|
(t1.openedUserName === condition.author.get.bind, condition.author.isDefined) &&
|
||||||
(t1.pullRequest === pullRequest.bind) &&
|
(t1.pullRequest === pullRequest.bind) &&
|
||||||
// Milestone filter
|
// Milestone filter
|
||||||
@@ -244,6 +243,8 @@ trait IssuesService {
|
|||||||
(t2.byPrimaryKey(t1.userName, t1.repositoryName, t1.milestoneId)) &&
|
(t2.byPrimaryKey(t1.userName, t1.repositoryName, t1.milestoneId)) &&
|
||||||
(t2.title === condition.milestone.get.get.bind)
|
(t2.title === condition.milestone.get.get.bind)
|
||||||
} exists, condition.milestone.flatten.isDefined) &&
|
} exists, condition.milestone.flatten.isDefined) &&
|
||||||
|
// Assignee filter
|
||||||
|
(t1.assignedUserName === condition.assigned.get.get.bind, condition.assigned.flatten.isDefined) &&
|
||||||
// Label filter
|
// Label filter
|
||||||
(IssueLabels filter { t2 =>
|
(IssueLabels filter { t2 =>
|
||||||
(t2.byIssue(t1.userName, t1.repositoryName, t1.issueId)) &&
|
(t2.byIssue(t1.userName, t1.repositoryName, t1.issueId)) &&
|
||||||
@@ -447,7 +448,7 @@ object IssuesService {
|
|||||||
labels: Set[String] = Set.empty,
|
labels: Set[String] = Set.empty,
|
||||||
milestone: Option[Option[String]] = None,
|
milestone: Option[Option[String]] = None,
|
||||||
author: Option[String] = None,
|
author: Option[String] = None,
|
||||||
assigned: Option[String] = None,
|
assigned: Option[Option[String]] = None,
|
||||||
mentioned: Option[String] = None,
|
mentioned: Option[String] = None,
|
||||||
state: String = "open",
|
state: String = "open",
|
||||||
sort: String = "created",
|
sort: String = "created",
|
||||||
@@ -491,12 +492,15 @@ object IssuesService {
|
|||||||
def toURL: String =
|
def toURL: String =
|
||||||
"?" + List(
|
"?" + List(
|
||||||
if(labels.isEmpty) None else Some("labels=" + urlEncode(labels.mkString(","))),
|
if(labels.isEmpty) None else Some("labels=" + urlEncode(labels.mkString(","))),
|
||||||
milestone.map { _ match {
|
milestone.map {
|
||||||
case Some(x) => "milestone=" + urlEncode(x)
|
case Some(x) => "milestone=" + urlEncode(x)
|
||||||
case None => "milestone=none"
|
case None => "milestone=none"
|
||||||
}},
|
},
|
||||||
author .map(x => "author=" + urlEncode(x)),
|
author .map(x => "author=" + urlEncode(x)),
|
||||||
assigned .map(x => "assigned=" + urlEncode(x)),
|
assigned.map {
|
||||||
|
case Some(x) => "assigned=" + urlEncode(x)
|
||||||
|
case None => "assigned=none"
|
||||||
|
},
|
||||||
mentioned.map(x => "mentioned=" + urlEncode(x)),
|
mentioned.map(x => "mentioned=" + urlEncode(x)),
|
||||||
Some("state=" + urlEncode(state)),
|
Some("state=" + urlEncode(state)),
|
||||||
Some("sort=" + urlEncode(sort)),
|
Some("sort=" + urlEncode(sort)),
|
||||||
@@ -541,10 +545,14 @@ object IssuesService {
|
|||||||
conditions.get("milestone").flatMap(_.headOption) match {
|
conditions.get("milestone").flatMap(_.headOption) match {
|
||||||
case None => None
|
case None => None
|
||||||
case Some("none") => Some(None)
|
case Some("none") => Some(None)
|
||||||
case Some(x) => Some(Some(x)) //milestones.get(x).map(x => Some(x))
|
case Some(x) => Some(Some(x))
|
||||||
},
|
},
|
||||||
conditions.get("author").flatMap(_.headOption),
|
conditions.get("author").flatMap(_.headOption),
|
||||||
conditions.get("assignee").flatMap(_.headOption),
|
conditions.get("assignee").flatMap(_.headOption) match {
|
||||||
|
case None => None
|
||||||
|
case Some("none") => Some(None)
|
||||||
|
case Some(x) => Some(Some(x))
|
||||||
|
},
|
||||||
conditions.get("mentions").flatMap(_.headOption),
|
conditions.get("mentions").flatMap(_.headOption),
|
||||||
conditions.get("is").getOrElse(Seq.empty).find(x => x == "open" || x == "closed").getOrElse("open"),
|
conditions.get("is").getOrElse(Seq.empty).find(x => x == "open" || x == "closed").getOrElse("open"),
|
||||||
sort,
|
sort,
|
||||||
@@ -565,7 +573,10 @@ object IssuesService {
|
|||||||
case x => Some(x)
|
case x => Some(x)
|
||||||
},
|
},
|
||||||
param(request, "author"),
|
param(request, "author"),
|
||||||
param(request, "assigned"),
|
param(request, "assigned").map {
|
||||||
|
case "none" => None
|
||||||
|
case x => Some(x)
|
||||||
|
},
|
||||||
param(request, "mentioned"),
|
param(request, "mentioned"),
|
||||||
param(request, "state", Seq("open", "closed")).getOrElse("open"),
|
param(request, "state", Seq("open", "closed")).getOrElse("open"),
|
||||||
param(request, "sort", Seq("created", "comments", "updated")).getOrElse("created"),
|
param(request, "sort", Seq("created", "comments", "updated")).getOrElse("created"),
|
||||||
|
|||||||
@@ -51,23 +51,28 @@
|
|||||||
}
|
}
|
||||||
@helper.html.dropdown("Milestone") {
|
@helper.html.dropdown("Milestone") {
|
||||||
<li>
|
<li>
|
||||||
<a href="@condition.copy(milestone = Some(None)).toURL">
|
<a href="@condition.copy(milestone = (if(condition.milestone == Some(None)) None else Some(None))).toURL">
|
||||||
@helper.html.checkicon(condition.milestone == Some(None)) Issues with no milestone
|
@helper.html.checkicon(condition.milestone == Some(None)) Issues with no milestone
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
@milestones.filter(_.closedDate.isEmpty).map { milestone =>
|
@milestones.filter(_.closedDate.isEmpty).map { milestone =>
|
||||||
<li>
|
<li>
|
||||||
<a href="@condition.copy(milestone = Some(Some(milestone.title))).toURL">
|
<a href="@condition.copy(milestone = (if(condition.milestone == Some(Some(milestone.title))) None else Some(Some(milestone.title)))).toURL">
|
||||||
@helper.html.checkicon(condition.milestone == Some(Some(milestone.title))) @milestone.title
|
@helper.html.checkicon(condition.milestone == Some(Some(milestone.title))) @milestone.title
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@helper.html.dropdown("Assignee") {
|
@helper.html.dropdown("Assignee") {
|
||||||
|
<li>
|
||||||
|
<a href="@condition.copy(assigned = (if(condition.assigned == Some(None)) None else Some(None))).toURL">
|
||||||
|
@helper.html.checkicon(condition.assigned == Some(None)) Assigned to nobody
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
@collaborators.map { collaborator =>
|
@collaborators.map { collaborator =>
|
||||||
<li>
|
<li>
|
||||||
<a href="@condition.copy(assigned = Some(collaborator)).toURL">
|
<a href="@condition.copy(assigned = (if(condition.assigned == Some(Some(collaborator))) None else Some(Some(collaborator)))).toURL">
|
||||||
@helper.html.checkicon(condition.assigned == Some(collaborator))
|
@helper.html.checkicon(condition.assigned == Some(Some(collaborator)))
|
||||||
@avatar(collaborator, 20) @collaborator
|
@avatar(collaborator, 20) @collaborator
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
Reference in New Issue
Block a user