mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
[MM-16146] When converting a bot to a user, set the role to system_user (#11361)
* when converting a bot to a user, set the role to system_user * correct govet shadow error * Change from inline error checking and fix shadow error * Add SYSTEM_USER_ROLE_ID to the bot user model instead of updating the role after the bot user is created * modify UserFromBot test to include Roles field
This commit is contained in:
committed by
Christopher Speller
parent
3bce32bbcf
commit
0cae57a6cd
@@ -169,6 +169,7 @@ func UserFromBot(b *Bot) *User {
|
||||
Username: b.Username,
|
||||
Email: fmt.Sprintf("%s@localhost", strings.ToLower(b.Username)),
|
||||
FirstName: b.DisplayName,
|
||||
Roles: SYSTEM_USER_ROLE_ID,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -508,12 +508,14 @@ func TestUserFromBot(t *testing.T) {
|
||||
Username: "username",
|
||||
Email: "username@localhost",
|
||||
FirstName: "display name",
|
||||
Roles: "system_user",
|
||||
}, UserFromBot(bot1))
|
||||
assert.Equal(t, &User{
|
||||
Id: bot2.UserId,
|
||||
Username: "username2",
|
||||
Email: "username2@localhost",
|
||||
FirstName: "display name 2",
|
||||
Roles: "system_user",
|
||||
}, UserFromBot(bot2))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user