mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-07 14:05:52 +01:00
Add function to close multiple issues with one keyword on commits (#2491)
This commit is contained in:
@@ -151,8 +151,13 @@ object StringUtil {
|
|||||||
* @return the iterator of issue id
|
* @return the iterator of issue id
|
||||||
*/
|
*/
|
||||||
def extractCloseId(message: String): Seq[String] =
|
def extractCloseId(message: String): Seq[String] =
|
||||||
"(?i)(?<!\\w)(?:fix(?:e[sd])?|resolve[sd]?|close[sd]?)\\s+#(\\d+)(?!\\w)".r
|
"#(\\d+)".r
|
||||||
|
.findAllIn(
|
||||||
|
"(?i)(?<!\\w)(?:fix(?:e[sd])?|resolve[sd]?|close[sd]?)\\s+#(\\d+)(,\\s?#(\\d+))*(?!\\w)".r
|
||||||
.findAllIn(message)
|
.findAllIn(message)
|
||||||
|
.toSeq
|
||||||
|
.mkString(",")
|
||||||
|
)
|
||||||
.matchData
|
.matchData
|
||||||
.map(_.group(1))
|
.map(_.group(1))
|
||||||
.toSeq
|
.toSeq
|
||||||
|
|||||||
@@ -64,6 +64,9 @@ class StringUtilSpec extends AnyFunSpec {
|
|||||||
it("should returns Nil from message which does not contain close command") {
|
it("should returns Nil from message which does not contain close command") {
|
||||||
assert(StringUtil.extractCloseId("(refs #123)").toSeq == Nil)
|
assert(StringUtil.extractCloseId("(refs #123)").toSeq == Nil)
|
||||||
}
|
}
|
||||||
|
it("should extract 'close #x, #y, #z' and return extracted multi id") {
|
||||||
|
assert(StringUtil.extractCloseId("(close #1, #2, #3, wip #4, close #5)").toSeq == Seq("1", "2", "3", "5"))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
describe("getRepositoryViewerUrl") {
|
describe("getRepositoryViewerUrl") {
|
||||||
|
|||||||
Reference in New Issue
Block a user