mirror of
https://github.com/minetest/contentdb.git
synced 2025-01-10 23:17:37 +01:00
Fix release auto-approval
This commit is contained in:
parent
2677e088a8
commit
93a74b7681
@ -696,6 +696,15 @@ class PackageRelease(db.Model):
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.releaseDate = datetime.datetime.now()
|
self.releaseDate = datetime.datetime.now()
|
||||||
|
|
||||||
|
def approve(self, user):
|
||||||
|
if not self.package.checkPerm(user, Permission.APPROVE_RELEASE):
|
||||||
|
return False
|
||||||
|
|
||||||
|
assert(self.task_id is None and self.url is not None and self.url != "")
|
||||||
|
|
||||||
|
self.approved = True
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
class PackageReview(db.Model):
|
class PackageReview(db.Model):
|
||||||
id = db.Column(db.Integer, primary_key=True)
|
id = db.Column(db.Integer, primary_key=True)
|
||||||
|
@ -348,6 +348,7 @@ def makeVCSReleaseFromGithub(id, branch, release, url):
|
|||||||
release.url = urlmaker.getCommitDownload(commits[0]["sha"])
|
release.url = urlmaker.getCommitDownload(commits[0]["sha"])
|
||||||
release.task_id = None
|
release.task_id = None
|
||||||
release.commit_hash = commits[0]["sha"]
|
release.commit_hash = commits[0]["sha"]
|
||||||
|
release.approve(release.package.author)
|
||||||
print(release.url)
|
print(release.url)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
@ -379,6 +380,7 @@ def makeVCSRelease(id, branch):
|
|||||||
release.url = "/uploads/" + filename
|
release.url = "/uploads/" + filename
|
||||||
release.task_id = None
|
release.task_id = None
|
||||||
release.commit_hash = repo.head.object.hexsha
|
release.commit_hash = repo.head.object.hexsha
|
||||||
|
release.approve(release.package.author)
|
||||||
print(release.url)
|
print(release.url)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
|
@ -85,7 +85,6 @@ def create_release_page(package):
|
|||||||
rel.task_id = uuid()
|
rel.task_id = uuid()
|
||||||
rel.min_rel = form["min_rel"].data.getActual()
|
rel.min_rel = form["min_rel"].data.getActual()
|
||||||
rel.max_rel = form["max_rel"].data.getActual()
|
rel.max_rel = form["max_rel"].data.getActual()
|
||||||
rel.approved = package.checkPerm(current_user, Permission.APPROVE_RELEASE)
|
|
||||||
db.session.add(rel)
|
db.session.add(rel)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
@ -105,7 +104,7 @@ def create_release_page(package):
|
|||||||
rel.url = uploadedPath
|
rel.url = uploadedPath
|
||||||
rel.min_rel = form["min_rel"].data.getActual()
|
rel.min_rel = form["min_rel"].data.getActual()
|
||||||
rel.max_rel = form["max_rel"].data.getActual()
|
rel.max_rel = form["max_rel"].data.getActual()
|
||||||
rel.approved = package.checkPerm(current_user, Permission.APPROVE_RELEASE)
|
rel.approve(current_user)
|
||||||
db.session.add(rel)
|
db.session.add(rel)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user