aboutsummaryrefslogtreecommitdiffstats
path: root/models/user
diff options
context:
space:
mode:
authorYarden Shoham <git@yardenshoham.com>2023-05-26 19:58:11 +0300
committerGitHub <noreply@github.com>2023-05-26 18:58:11 +0200
commitabccb86b36d8c9e680768fcff0c0dc05f1cd9447 (patch)
tree396ebe7c76696c7c275f06dd5e45e49cd5478e67 /models/user
parent85fa954a3810b233cb299f455546c4b2314400b3 (diff)
downloadgitea-abccb86b36d8c9e680768fcff0c0dc05f1cd9447.tar.gz
gitea-abccb86b36d8c9e680768fcff0c0dc05f1cd9447.zip
Show `bot` label next to username when rendering autor link if the user is a bot (#24943)
If the user is a bot, we'll add a label next to the author link that says `bot`. I didn't localize `bot` because passing `locale` into the `autorlink` template would require changing all calls. # Example `yardenshoham` is a bot. ## Before ![image](https://github.com/go-gitea/gitea/assets/20454870/77390780-b763-4f0f-b358-bbccdbf17a5d) ## After ![image](https://github.com/go-gitea/gitea/assets/20454870/72af342f-ee76-4337-95ad-4ecaba853fed) --------- Signed-off-by: Yarden Shoham <git@yardenshoham.com>
Diffstat (limited to 'models/user')
-rw-r--r--models/user/user.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/models/user/user.go b/models/user/user.go
index 07d8177b6a..2077d55f51 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 {