mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-06 05:25:50 +01:00
Reformat with scalafmt 3.9.7
Executed command: scalafmt --non-interactive
This commit is contained in:
@@ -628,7 +628,7 @@ trait RepositorySettingsControllerBase extends ControllerBase {
|
|||||||
new Constraint() {
|
new Constraint() {
|
||||||
override def validate(name: String, value: String, messages: Messages): Option[String] =
|
override def validate(name: String, value: String, messages: Messages): Option[String] =
|
||||||
getAccountByUserName(value) match {
|
getAccountByUserName(value) match {
|
||||||
case None => Some("User does not exist.")
|
case None => Some("User does not exist.")
|
||||||
case Some(x) =>
|
case Some(x) =>
|
||||||
if (x.userName == params("owner")) {
|
if (x.userName == params("owner")) {
|
||||||
Some("This is current repository owner.")
|
Some("This is current repository owner.")
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ trait ApiGitReferenceControllerBase extends ControllerBase {
|
|||||||
|
|
||||||
val name = RepositoryName(repository)
|
val name = RepositoryName(repository)
|
||||||
val result = JsonFormat(revstr match {
|
val result = JsonFormat(revstr match {
|
||||||
case "tags" => repository.tags.map(ApiRef.fromTag(name, _))
|
case "tags" => repository.tags.map(ApiRef.fromTag(name, _))
|
||||||
case x if x.startsWith("tags/") =>
|
case x if x.startsWith("tags/") =>
|
||||||
val tagName = x.substring("tags/".length)
|
val tagName = x.substring("tags/".length)
|
||||||
repository.tags.find(_.name == tagName) match {
|
repository.tags.find(_.name == tagName) match {
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ trait ApiIssueMilestoneControllerBase extends ControllerBase {
|
|||||||
)
|
)
|
||||||
}).reverse
|
}).reverse
|
||||||
state match {
|
state match {
|
||||||
case "all" => JsonFormat(apiMilestones)
|
case "all" => JsonFormat(apiMilestones)
|
||||||
case "open" | "closed" =>
|
case "open" | "closed" =>
|
||||||
JsonFormat(
|
JsonFormat(
|
||||||
apiMilestones.filter(p => p.state == state)
|
apiMilestones.filter(p => p.state == state)
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ trait AccountFederationService {
|
|||||||
.orElse(extractSafeStringForUserName(mailAddress)) match {
|
.orElse(extractSafeStringForUserName(mailAddress)) match {
|
||||||
case Some(safeUserName) =>
|
case Some(safeUserName) =>
|
||||||
getAccountByUserName(safeUserName, includeRemoved = true) match {
|
getAccountByUserName(safeUserName, includeRemoved = true) match {
|
||||||
case None => Some(safeUserName)
|
case None => Some(safeUserName)
|
||||||
case Some(_) =>
|
case Some(_) =>
|
||||||
logger.info(
|
logger.info(
|
||||||
s"User ($safeUserName) already exists. preferredUserName=$preferredUserName, mailAddress=$mailAddress"
|
s"User ($safeUserName) already exists. preferredUserName=$preferredUserName, mailAddress=$mailAddress"
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ trait AccountService {
|
|||||||
case account if !account.isGroupAccount =>
|
case account if !account.isGroupAccount =>
|
||||||
account.password match {
|
account.password match {
|
||||||
case pbkdf2re(iter, salt, hash) if (pbkdf2_sha256(iter.toInt, salt, password) == hash) => Some(account)
|
case pbkdf2re(iter, salt, hash) if (pbkdf2_sha256(iter.toInt, salt, password) == hash) => Some(account)
|
||||||
case p if p == sha1(password) =>
|
case p if p == sha1(password) =>
|
||||||
updateAccount(account.copy(password = pbkdf2_sha256(password)))
|
updateAccount(account.copy(password = pbkdf2_sha256(password)))
|
||||||
Some(account)
|
Some(account)
|
||||||
case _ => None
|
case _ => None
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ trait HandleCommentService {
|
|||||||
.getOrElse(None -> None)
|
.getOrElse(None -> None)
|
||||||
|
|
||||||
val commentId = (content, action) match {
|
val commentId = (content, action) match {
|
||||||
case (None, None) => None
|
case (None, None) => None
|
||||||
case (None, Some(action)) =>
|
case (None, Some(action)) =>
|
||||||
Some(createComment(owner, name, userName, issue.issueId, action.capitalize, action))
|
Some(createComment(owner, name, userName, issue.issueId, action.capitalize, action))
|
||||||
case (Some(content), _) =>
|
case (Some(content), _) =>
|
||||||
|
|||||||
@@ -427,7 +427,7 @@ trait PullRequestService {
|
|||||||
case Some(patch) =>
|
case Some(patch) =>
|
||||||
file -> comments.foreach { case (commentId, lineNumber) =>
|
file -> comments.foreach { case (commentId, lineNumber) =>
|
||||||
lineNumber match {
|
lineNumber match {
|
||||||
case Left(oldLine) => updateCommitCommentPosition(commentId, newCommitId, Some(oldLine), None)
|
case Left(oldLine) => updateCommitCommentPosition(commentId, newCommitId, Some(oldLine), None)
|
||||||
case Right(newLine) =>
|
case Right(newLine) =>
|
||||||
var counter = newLine
|
var counter = newLine
|
||||||
patch.getDeltas.asScala.filter(_.getSource.getPosition < newLine).foreach { delta =>
|
patch.getDeltas.asScala.filter(_.getSource.getPosition < newLine).foreach { delta =>
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ class ApiAuthenticationFilter extends Filter with AccessTokenService with Accoun
|
|||||||
updateLastLoginDate(account.userName)
|
updateLastLoginDate(account.userName)
|
||||||
}
|
}
|
||||||
chain.doFilter(req, res)
|
chain.doFilter(req, res)
|
||||||
case None => chain.doFilter(req, res)
|
case None => chain.doFilter(req, res)
|
||||||
case Some(Left(_)) => {
|
case Some(Left(_)) => {
|
||||||
response.setStatus(HttpServletResponse.SC_UNAUTHORIZED)
|
response.setStatus(HttpServletResponse.SC_UNAUTHORIZED)
|
||||||
response.setContentType("application/json; charset=utf-8")
|
response.setContentType("application/json; charset=utf-8")
|
||||||
|
|||||||
@@ -543,7 +543,7 @@ class WikiCommitHook(owner: String, repository: String, pusher: String, baseUrl:
|
|||||||
case ChangeType.ADD | ChangeType.RENAME => "created"
|
case ChangeType.ADD | ChangeType.RENAME => "created"
|
||||||
case ChangeType.MODIFY => "edited"
|
case ChangeType.MODIFY => "edited"
|
||||||
case ChangeType.DELETE => "deleted"
|
case ChangeType.DELETE => "deleted"
|
||||||
case other =>
|
case other =>
|
||||||
logger.error(s"Unsupported Wiki action: $other")
|
logger.error(s"Unsupported Wiki action: $other")
|
||||||
"unsupported action"
|
"unsupported action"
|
||||||
}
|
}
|
||||||
@@ -560,7 +560,7 @@ class WikiCommitHook(owner: String, repository: String, pusher: String, baseUrl:
|
|||||||
case "created" => Some(CreateWikiPageInfo(owner, repo, commit.committerName, pageName))
|
case "created" => Some(CreateWikiPageInfo(owner, repo, commit.committerName, pageName))
|
||||||
case "edited" => Some(EditWikiPageInfo(owner, repo, commit.committerName, pageName, commit.id))
|
case "edited" => Some(EditWikiPageInfo(owner, repo, commit.committerName, pageName, commit.id))
|
||||||
case "deleted" => Some(DeleteWikiInfo(owner, repo, commit.committerName, pageName))
|
case "deleted" => Some(DeleteWikiInfo(owner, repo, commit.committerName, pageName))
|
||||||
case other =>
|
case other =>
|
||||||
logger.info(s"Attempted to build wiki record for unsupported action: $other")
|
logger.info(s"Attempted to build wiki record for unsupported action: $other")
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ object Directory {
|
|||||||
val GitBucketHome = (System.getProperty("gitbucket.home") match {
|
val GitBucketHome = (System.getProperty("gitbucket.home") match {
|
||||||
// -Dgitbucket.home=<path>
|
// -Dgitbucket.home=<path>
|
||||||
case path if (path != null) => new File(path)
|
case path if (path != null) => new File(path)
|
||||||
case _ =>
|
case _ =>
|
||||||
scala.util.Properties.envOrNone("GITBUCKET_HOME") match {
|
scala.util.Properties.envOrNone("GITBUCKET_HOME") match {
|
||||||
// environment variable GITBUCKET_HOME
|
// environment variable GITBUCKET_HOME
|
||||||
case Some(env) => new File(env)
|
case Some(env) => new File(env)
|
||||||
|
|||||||
@@ -669,7 +669,7 @@ object JGitUtil {
|
|||||||
val objectId = git.getRepository.resolve(name)
|
val objectId = git.getRepository.resolve(name)
|
||||||
git.getRepository.open(objectId).getType match {
|
git.getRepository.open(objectId).getType match {
|
||||||
case Constants.OBJ_COMMIT => objectId
|
case Constants.OBJ_COMMIT => objectId
|
||||||
case Constants.OBJ_TAG =>
|
case Constants.OBJ_TAG =>
|
||||||
val ref = git.getRepository.getRefDatabase.findRef(name)
|
val ref = git.getRepository.getRefDatabase.findRef(name)
|
||||||
git.getRepository.getRefDatabase.peel(ref).getPeeledObjectId
|
git.getRepository.getRefDatabase.peel(ref).getPeeledObjectId
|
||||||
case _ => ObjectId.zeroId()
|
case _ => ObjectId.zeroId()
|
||||||
|
|||||||
@@ -53,8 +53,8 @@ object helpers extends AvatarImageProvider with LinkConverter with RequestCache
|
|||||||
def datetimeAgoRecentOnly(date: Date): String = {
|
def datetimeAgoRecentOnly(date: Date): String = {
|
||||||
val duration = new Date().getTime - date.getTime
|
val duration = new Date().getTime - date.getTime
|
||||||
timeUnits.find(tuple => duration / tuple._1 > 0) match {
|
timeUnits.find(tuple => duration / tuple._1 > 0) match {
|
||||||
case Some((_, "month")) => s"on ${new SimpleDateFormat("d MMM", Locale.ENGLISH).format(date)}"
|
case Some((_, "month")) => s"on ${new SimpleDateFormat("d MMM", Locale.ENGLISH).format(date)}"
|
||||||
case Some((_, "year")) => s"on ${new SimpleDateFormat("d MMM yyyy", Locale.ENGLISH).format(date)}"
|
case Some((_, "year")) => s"on ${new SimpleDateFormat("d MMM yyyy", Locale.ENGLISH).format(date)}"
|
||||||
case Some((unitValue, unitString)) =>
|
case Some((unitValue, unitString)) =>
|
||||||
val value = duration / unitValue
|
val value = duration / unitValue
|
||||||
s"${value} ${unitString}${if (value > 1) "s" else ""} ago"
|
s"${value} ${unitString}${if (value > 1) "s" else ""} ago"
|
||||||
|
|||||||
Reference in New Issue
Block a user