Use a new name for bots

This commit is contained in:
Lunny Xiao 2022-11-22 16:04:10 +08:00 committed by Jason Song
parent 45afa0ee9f
commit 52b32c37ad

View File

@ -36,19 +36,22 @@ func NewReplaceUser(name string) *User {
} }
} }
const BotUserID = -2 const (
BotUserID = -2
BotUserName = "[robot]gitea-bots"
)
// NewBotUser creates and returns a fake user for running the build. // NewBotUser creates and returns a fake user for running the build.
func NewBotUser() *User { func NewBotUser() *User {
return &User{ return &User{
ID: BotUserID, ID: BotUserID,
Name: "gitea-bots", Name: "[robot]gitea-bots",
LowerName: "gitea-bots", LowerName: "[robot]gitea-bots",
IsActive: true, IsActive: true,
FullName: "Gitea Bots", FullName: "Gitea Bots",
Email: "teabot@gitea.io", Email: "teabot@gitea.io",
KeepEmailPrivate: true, KeepEmailPrivate: true,
LoginName: "gitea-bots", LoginName: "[robot]gitea-bots",
Type: UserTypeIndividual, Type: UserTypeIndividual,
AllowCreateOrganization: true, AllowCreateOrganization: true,
Visibility: structs.VisibleTypePublic, Visibility: structs.VisibleTypePublic,
@ -59,5 +62,5 @@ func (u *User) IsBots() bool {
if u == nil { if u == nil {
return false return false
} }
return u.ID == BotUserID && u.Name == "gitea-bots" return u.ID == BotUserID && u.Name == BotUserName
} }