mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-09 23:15:49 +01:00
(refs #171)Fix link target of pull request number.
This commit is contained in:
@@ -15,10 +15,12 @@ trait LinkConverter { self: RequestCache =>
|
|||||||
.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll("\"", """)
|
.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll("\"", """)
|
||||||
// convert issue id to link
|
// convert issue id to link
|
||||||
.replaceBy(("(^|\\W)" + issueIdPrefix + "(\\d+)(\\W|$)").r){ m =>
|
.replaceBy(("(^|\\W)" + issueIdPrefix + "(\\d+)(\\W|$)").r){ m =>
|
||||||
if(getIssue(repository.owner, repository.name, m.group(2)).isDefined){
|
getIssue(repository.owner, repository.name, m.group(2)) match {
|
||||||
Some(s"""${m.group(1)}<a href="${context.path}/${repository.owner}/${repository.name}/issues/${m.group(2)}">#${m.group(2)}</a>${m.group(3)}""")
|
case Some(issue) if(issue.isPullRequest)
|
||||||
} else {
|
=> Some(s"""${m.group(1)}<a href="${context.path}/${repository.owner}/${repository.name}/pull/${m.group(2)}">#${m.group(2)}</a>${m.group(3)}""")
|
||||||
Some(s"""${m.group(1)}#${m.group(2)}${m.group(3)}""")
|
case Some(_) => Some(s"""${m.group(1)}<a href="${context.path}/${repository.owner}/${repository.name}/issues/${m.group(2)}">#${m.group(2)}</a>${m.group(3)}""")
|
||||||
|
case None => Some(s"""${m.group(1)}#${m.group(2)}${m.group(3)}""")
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// convert @username to link
|
// convert @username to link
|
||||||
|
|||||||
Reference in New Issue
Block a user