Merge pull request #5886 from ioito/automated-cherry-pick-of-#5884-upstream-release-3.1

Automated cherry pick of #5884: fix: 仅当变更domainId时才需要更新projectId
This commit is contained in:
Zexi Li
2020-04-22 10:32:39 +08:00
committed by GitHub
+4 -2
View File
@@ -182,8 +182,10 @@ func (self *SExternalProject) SyncWithCloudProject(ctx context.Context, userCred
diff, err := db.UpdateWithLock(ctx, self, func() error {
self.Name = ext.GetName()
self.IsEmulated = ext.IsEmulated()
self.ProjectId = provider.ProjectId
self.DomainId = provider.DomainId
if self.DomainId != provider.DomainId {
self.ProjectId = provider.ProjectId
self.DomainId = provider.DomainId
}
return nil
})
if err != nil {