Fix bugs related to package owner not being a maintainer

This commit is contained in:
rubenwardy 2020-07-11 16:56:36 +01:00
parent 729241c0fe
commit 868ced76a8
2 changed files with 5 additions and 1 deletions

View File

@ -257,6 +257,7 @@ def create_edit(author=None, name=None):
package = Package()
package.author = author
package.maintainers.append(author)
wasNew = True
elif package.approved and package.name != form.name.data and \
@ -428,7 +429,8 @@ def edit_maintainers(package):
package.maintainers.clear()
package.maintainers.extend(users)
package.maintainers.append(package.author)
if package.author not in package.maintainers:
package.maintainers.append(package.author)
msg = "Edited {} maintainers".format(package.title)
addNotification(package.author, current_user, msg, package.getDetailsURL(), package)

View File

@ -492,6 +492,8 @@ class Package(db.Model):
self.created_at = package.created_at
self.approved = package.approved
self.maintainers.append(self.author)
for e in PackagePropertyKey:
setattr(self, e.name, getattr(package, e.name))