diff --git a/src/main/scala/gitbucket/core/view/helpers.scala b/src/main/scala/gitbucket/core/view/helpers.scala index 33fdce9..570e9b1 100644 --- a/src/main/scala/gitbucket/core/view/helpers.scala +++ b/src/main/scala/gitbucket/core/view/helpers.scala @@ -225,6 +225,13 @@ def avatarLink(userName: String, size: Int, mailAddress: String = "", tooltip: Boolean = false)(implicit context: Context): Html = userWithContent(userName, mailAddress)(avatar(userName, size, tooltip, mailAddress)) + /** + * Generates the avatar link to the account page. + * If user does not exist or disabled, this method returns avatar image without link. + */ + def avatarLink(commit: JGitUtil.CommitInfo, size: Int)(implicit context: Context): Html = + userWithContent(commit.authorName, commit.authorEmailAddress)(avatar(commit, size)) + private def userWithContent(userName: String, mailAddress: String = "", styleClass: String = "")(content: Html)(implicit context: Context): Html = (if(mailAddress.isEmpty){ getAccountByUserName(userName) diff --git a/src/main/twirl/gitbucket/core/account/main.scala.html b/src/main/twirl/gitbucket/core/account/main.scala.html index 0e17090..dcf5a40 100644 --- a/src/main/twirl/gitbucket/core/account/main.scala.html +++ b/src/main/twirl/gitbucket/core/account/main.scala.html @@ -22,7 +22,7 @@
Groups
@groupNames.map { groupName => - @avatar(groupName, 36, tooltip = true) + @avatarLink(groupName, 36, tooltip = true) }
} diff --git a/src/main/twirl/gitbucket/core/helper/commitcomment.scala.html b/src/main/twirl/gitbucket/core/helper/commitcomment.scala.html index e26f9c4..73d938e 100644 --- a/src/main/twirl/gitbucket/core/helper/commitcomment.scala.html +++ b/src/main/twirl/gitbucket/core/helper/commitcomment.scala.html @@ -10,7 +10,7 @@ @if(comment.fileName.isDefined){filename="@comment.fileName.get"} @if(comment.newLine.isDefined){newline="@comment.newLine.get"} @if(comment.oldLine.isDefined){oldline="@comment.oldLine.get"}> -
@avatar(comment.commentedUserName, 48)
+
@avatarLink(comment.commentedUserName, 48)
@user(comment.commentedUserName, styleClass="username strong") diff --git a/src/main/twirl/gitbucket/core/issues/commentform.scala.html b/src/main/twirl/gitbucket/core/issues/commentform.scala.html index d6a63d1..c6b0f61 100644 --- a/src/main/twirl/gitbucket/core/issues/commentform.scala.html +++ b/src/main/twirl/gitbucket/core/issues/commentform.scala.html @@ -7,7 +7,7 @@ @if(loginAccount.isDefined){

-
@avatar(loginAccount.get.userName, 48)
+
@avatarLink(loginAccount.get.userName, 48)
@helper.html.preview( diff --git a/src/main/twirl/gitbucket/core/issues/commentlist.scala.html b/src/main/twirl/gitbucket/core/issues/commentlist.scala.html index d616cb5..8c63692 100644 --- a/src/main/twirl/gitbucket/core/issues/commentlist.scala.html +++ b/src/main/twirl/gitbucket/core/issues/commentlist.scala.html @@ -7,7 +7,7 @@ @import gitbucket.core.view.helpers._ @import gitbucket.core.model.CommitComment @if(issue.isDefined){ -
@avatar(issue.get.openedUserName, 48)
+
@avatarLink(issue.get.openedUserName, 48)
@user(issue.get.openedUserName, styleClass="username strong") commented @helper.html.datetimeago(issue.get.registeredDate) @@ -36,7 +36,7 @@ case comment: gitbucket.core.model.IssueComment => { @if(comment.action != "close" && comment.action != "reopen" && comment.action != "delete_branch" && comment.action != "commit" && comment.action != "refer"){ -
@avatar(comment.commentedUserName, 48)
+
@avatarLink(comment.commentedUserName, 48)
@user(comment.commentedUserName, styleClass="username strong") diff --git a/src/main/twirl/gitbucket/core/issues/create.scala.html b/src/main/twirl/gitbucket/core/issues/create.scala.html index 2da6bd4..6b2865d 100644 --- a/src/main/twirl/gitbucket/core/issues/create.scala.html +++ b/src/main/twirl/gitbucket/core/issues/create.scala.html @@ -10,7 +10,7 @@
-
@avatar(loginAccount.get.userName, 48)
+
@avatarLink(loginAccount.get.userName, 48)
diff --git a/src/main/twirl/gitbucket/core/pulls/commits.scala.html b/src/main/twirl/gitbucket/core/pulls/commits.scala.html index 72ecc9b..6ce399d 100644 --- a/src/main/twirl/gitbucket/core/pulls/commits.scala.html +++ b/src/main/twirl/gitbucket/core/pulls/commits.scala.html @@ -17,7 +17,7 @@
  • -
    @avatar(commit, 40)
    +
    @avatarLink(commit, 40)
    @link(commit.summary, repository) @if(commit.description.isDefined){ diff --git a/src/main/twirl/gitbucket/core/pulls/compare.scala.html b/src/main/twirl/gitbucket/core/pulls/compare.scala.html index 70dcfca..15d4015 100644 --- a/src/main/twirl/gitbucket/core/pulls/compare.scala.html +++ b/src/main/twirl/gitbucket/core/pulls/compare.scala.html @@ -55,7 +55,7 @@
    -
    @avatar(loginAccount.get.userName, 48)
    +
    @avatarLink(loginAccount.get.userName, 48)
    diff --git a/src/main/twirl/gitbucket/core/repo/commentform.scala.html b/src/main/twirl/gitbucket/core/repo/commentform.scala.html index 2aaa162..2535212 100644 --- a/src/main/twirl/gitbucket/core/repo/commentform.scala.html +++ b/src/main/twirl/gitbucket/core/repo/commentform.scala.html @@ -11,7 +11,7 @@ @if(!fileName.isDefined){

    } @if(!fileName.isDefined){ -
    @avatar(loginAccount.get.userName, 48)
    +
    @avatarLink(loginAccount.get.userName, 48)
    }
    diff --git a/src/main/twirl/gitbucket/core/repo/commits.scala.html b/src/main/twirl/gitbucket/core/repo/commits.scala.html index 66e7ba9..acfd460 100644 --- a/src/main/twirl/gitbucket/core/repo/commits.scala.html +++ b/src/main/twirl/gitbucket/core/repo/commits.scala.html @@ -46,7 +46,7 @@
  • -
    @avatar(commit, 40)
    +
    @avatarLink(commit, 40)
    @link(commit.summary, repository) @if(commit.description.isDefined){ diff --git a/src/main/twirl/gitbucket/core/repo/delete.scala.html b/src/main/twirl/gitbucket/core/repo/delete.scala.html index 0af5043..548cc32 100644 --- a/src/main/twirl/gitbucket/core/repo/delete.scala.html +++ b/src/main/twirl/gitbucket/core/repo/delete.scala.html @@ -33,7 +33,7 @@ -
    @avatar(loginAccount.get.userName, 48)
    +
    @avatarLink(loginAccount.get.userName, 48)
    diff --git a/src/main/twirl/gitbucket/core/repo/editor.scala.html b/src/main/twirl/gitbucket/core/repo/editor.scala.html index 27cf1ed..2096ed3 100644 --- a/src/main/twirl/gitbucket/core/repo/editor.scala.html +++ b/src/main/twirl/gitbucket/core/repo/editor.scala.html @@ -47,7 +47,7 @@ -
    @avatar(loginAccount.get.userName, 48)
    +
    @avatarLink(loginAccount.get.userName, 48)