do not add prefix for the legacy robots (#13966)

Signed-off-by: Wang Yan <wangyan@vmware.com>
This commit is contained in:
Wang Yan 2021-01-12 16:43:54 +08:00 committed by GitHub
parent 7abe2ad9a3
commit dedb86384b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -211,9 +211,15 @@ func (d *controller) populate(ctx context.Context, r *model.Robot, option *Optio
robot := &Robot{
Robot: *r,
}
robot.Name = fmt.Sprintf("%s%s", config.RobotPrefix(), r.Name)
robot.setLevel()
robot.setEditable()
// for the v2 robots, add prefix to the robot name
// for the v1 legacy robots, keep the robot name
if robot.Editable {
robot.Name = fmt.Sprintf("%s%s", config.RobotPrefix(), r.Name)
} else {
robot.Name = r.Name
}
if option != nil && option.WithPermission {
if err := d.populatePermissions(ctx, robot); err != nil {
return nil, err