From ba42db361c487370c4942643855c1cb4fb6d914b Mon Sep 17 00:00:00 2001 From: Yarden Shoham Date: Fri, 26 May 2023 09:09:58 +0000 Subject: [PATCH 1/2] Show `bot` label next to username if the user is a bot Signed-off-by: Yarden Shoham --- models/user/user.go | 5 +++++ templates/shared/user/authorlink.tmpl | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/models/user/user.go b/models/user/user.go index 07d8177b6a903..2077d55f513e0 100644 --- a/models/user/user.go +++ b/models/user/user.go @@ -406,6 +406,11 @@ func (u *User) IsIndividual() bool { return u.Type == UserTypeIndividual } +// IsBot returns whether or not the user is of type bot +func (u *User) IsBot() bool { + return u.Type == UserTypeBot +} + // DisplayName returns full name if it's not empty, // returns username otherwise. func (u *User) DisplayName() string { diff --git a/templates/shared/user/authorlink.tmpl b/templates/shared/user/authorlink.tmpl index 71cbb8676e68d..140335c634a4c 100644 --- a/templates/shared/user/authorlink.tmpl +++ b/templates/shared/user/authorlink.tmpl @@ -1 +1 @@ -{{.GetDisplayName}} +{{.GetDisplayName}}{{if .IsBot}}bot{{end}} From ceb76e76b5c3b699dedaab0412ef46957eca7d35 Mon Sep 17 00:00:00 2001 From: Yarden Shoham Date: Fri, 26 May 2023 10:04:35 +0000 Subject: [PATCH 2/2] Style the label --- templates/shared/user/authorlink.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/shared/user/authorlink.tmpl b/templates/shared/user/authorlink.tmpl index 140335c634a4c..64ccc62cd0115 100644 --- a/templates/shared/user/authorlink.tmpl +++ b/templates/shared/user/authorlink.tmpl @@ -1 +1 @@ -{{.GetDisplayName}}{{if .IsBot}}bot{{end}} +{{.GetDisplayName}}{{if .IsBot}}bot{{end}}