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):
|
||||
contributor=Contributor()
|
||||
contributor.load(self.deletedContributors[email])
|
||||
for uuid in self.deletedContributions:
|
||||
contributor.load(self.deletedContributors[email].export())
|
||||
for uuid in self.deletedContributions.keys():
|
||||
if self.deletedContributions[uuid].contributor==contributor.email and self.deletedContributions[uuid].lastChange==contributor.deletionTime:
|
||||
self.contributions[uuid]=Contribution()
|
||||
self.contributions[uuid].load(self.deletedContributions[uuid].export())
|
||||
|
@ -127,9 +127,9 @@ class Group(object):
|
|||
|
||||
def deleteContributor(self, email, time):
|
||||
contributor=Contributor()
|
||||
contributor.load(self.contributors[email])
|
||||
contributor.load(self.contributors[email].export())
|
||||
contributor.deletionTime=time
|
||||
for uuid in self.contributions:
|
||||
for uuid in self.contributions.keys():
|
||||
if self.contributions[uuid].contributor==email:
|
||||
self.deletedContributions[uuid]=Contribution()
|
||||
self.deletedContributions[uuid].load(self.contributions[uuid].export())
|
||||
|
@ -146,7 +146,7 @@ class Group(object):
|
|||
ret.name=group.name
|
||||
|
||||
## Deleted Contributors
|
||||
for email in self.deletedContributors:
|
||||
for email in self.deletedContributors.keys():
|
||||
if email not in group.deletedContributors:
|
||||
logging.debug('Contributor %s not deleted on the other' % email)
|
||||
lastChange=0
|
||||
|
@ -164,7 +164,7 @@ class Group(object):
|
|||
group.deleteContributor(email,self.deletedContributors[email].deletionTime)
|
||||
ret.deletedContributors[email]=self.deletedContributors[email]
|
||||
|
||||
for email in group.deletedContributors:
|
||||
for email in group.deletedContributors.keys():
|
||||
if email not in ret.deletedContributors:
|
||||
logging.debug('Contributor %s not deleted on me' % email)
|
||||
lastChange=0
|
||||
|
@ -183,9 +183,11 @@ class Group(object):
|
|||
ret.deletedContributors[email]=group.deletedContributors[email]
|
||||
|
||||
## 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:
|
||||
if email not in ret.contributors:
|
||||
if email not in ret.contributors and email not in ret.deletedContributors:
|
||||
ret.contributors[email]=group.contributors[email]
|
||||
|
||||
## Deleted Contributions
|
||||
|
|
Loading…
Reference in a new issue