Fix management of deletedContributors in sync process
This commit is contained in:
parent
823d9b0939
commit
4e883c3705
1 changed files with 10 additions and 8 deletions
|
@ -113,8 +113,8 @@ class Group(object):
|
||||||
|
|
||||||
def restoreContributor(self, email):
|
def restoreContributor(self, email):
|
||||||
contributor=Contributor()
|
contributor=Contributor()
|
||||||
contributor.load(self.deletedContributors[email])
|
contributor.load(self.deletedContributors[email].export())
|
||||||
for uuid in self.deletedContributions:
|
for uuid in self.deletedContributions.keys():
|
||||||
if self.deletedContributions[uuid].contributor==contributor.email and self.deletedContributions[uuid].lastChange==contributor.deletionTime:
|
if self.deletedContributions[uuid].contributor==contributor.email and self.deletedContributions[uuid].lastChange==contributor.deletionTime:
|
||||||
self.contributions[uuid]=Contribution()
|
self.contributions[uuid]=Contribution()
|
||||||
self.contributions[uuid].load(self.deletedContributions[uuid].export())
|
self.contributions[uuid].load(self.deletedContributions[uuid].export())
|
||||||
|
@ -127,9 +127,9 @@ class Group(object):
|
||||||
|
|
||||||
def deleteContributor(self, email, time):
|
def deleteContributor(self, email, time):
|
||||||
contributor=Contributor()
|
contributor=Contributor()
|
||||||
contributor.load(self.contributors[email])
|
contributor.load(self.contributors[email].export())
|
||||||
contributor.deletionTime=time
|
contributor.deletionTime=time
|
||||||
for uuid in self.contributions:
|
for uuid in self.contributions.keys():
|
||||||
if self.contributions[uuid].contributor==email:
|
if self.contributions[uuid].contributor==email:
|
||||||
self.deletedContributions[uuid]=Contribution()
|
self.deletedContributions[uuid]=Contribution()
|
||||||
self.deletedContributions[uuid].load(self.contributions[uuid].export())
|
self.deletedContributions[uuid].load(self.contributions[uuid].export())
|
||||||
|
@ -146,7 +146,7 @@ class Group(object):
|
||||||
ret.name=group.name
|
ret.name=group.name
|
||||||
|
|
||||||
## Deleted Contributors
|
## Deleted Contributors
|
||||||
for email in self.deletedContributors:
|
for email in self.deletedContributors.keys():
|
||||||
if email not in group.deletedContributors:
|
if email not in group.deletedContributors:
|
||||||
logging.debug('Contributor %s not deleted on the other' % email)
|
logging.debug('Contributor %s not deleted on the other' % email)
|
||||||
lastChange=0
|
lastChange=0
|
||||||
|
@ -164,7 +164,7 @@ class Group(object):
|
||||||
group.deleteContributor(email,self.deletedContributors[email].deletionTime)
|
group.deleteContributor(email,self.deletedContributors[email].deletionTime)
|
||||||
ret.deletedContributors[email]=self.deletedContributors[email]
|
ret.deletedContributors[email]=self.deletedContributors[email]
|
||||||
|
|
||||||
for email in group.deletedContributors:
|
for email in group.deletedContributors.keys():
|
||||||
if email not in ret.deletedContributors:
|
if email not in ret.deletedContributors:
|
||||||
logging.debug('Contributor %s not deleted on me' % email)
|
logging.debug('Contributor %s not deleted on me' % email)
|
||||||
lastChange=0
|
lastChange=0
|
||||||
|
@ -183,9 +183,11 @@ class Group(object):
|
||||||
ret.deletedContributors[email]=group.deletedContributors[email]
|
ret.deletedContributors[email]=group.deletedContributors[email]
|
||||||
|
|
||||||
## Contributors
|
## Contributors
|
||||||
ret.contributors=self.contributors
|
for email in self.contributors:
|
||||||
|
if email not in ret.deletedContributors:
|
||||||
|
ret.contributors[email]=self.contributors[email]
|
||||||
for email in group.contributors:
|
for email in group.contributors:
|
||||||
if email not in ret.contributors:
|
if email not in ret.contributors and email not in ret.deletedContributors:
|
||||||
ret.contributors[email]=group.contributors[email]
|
ret.contributors[email]=group.contributors[email]
|
||||||
|
|
||||||
## Deleted Contributions
|
## Deleted Contributions
|
||||||
|
|
Loading…
Reference in a new issue