mirror of
https://github.com/minetest/contentdb.git
synced 2025-01-08 22:17:34 +01:00
parent
211ed7c6fd
commit
71308d25d5
@ -215,6 +215,8 @@ class PackagePropertyKey(enum.Enum):
|
||||
type = "Type"
|
||||
license = "License"
|
||||
tags = "Tags"
|
||||
harddeps = "Hard Dependencies"
|
||||
softdeps = "Soft Dependencies"
|
||||
repo = "Repository"
|
||||
website = "Website"
|
||||
issueTracker = "Issue Tracker"
|
||||
@ -287,6 +289,17 @@ class Package(db.Model):
|
||||
requests = db.relationship("EditRequest", backref="package",
|
||||
lazy="dynamic")
|
||||
|
||||
def __init__(self, package=None):
|
||||
if package is None:
|
||||
return
|
||||
|
||||
self.author_id = package.author_id
|
||||
self.created_at = package.created_at
|
||||
self.approved = package.approved
|
||||
|
||||
for e in PackagePropertyKey:
|
||||
setattr(self, e.name, getattr(package, e.name))
|
||||
|
||||
def getAsDictionary(self, base_url):
|
||||
return {
|
||||
"name": self.name,
|
||||
|
@ -86,7 +86,7 @@
|
||||
<li><a href="{{ package.getNewScreenshotURL() }}">Add screenshot</a></li>
|
||||
{% endif %}
|
||||
{% if current_user.is_authenticated %}
|
||||
<!-- <li><a href="{{ package.getCreateEditRequestURL() }}">Suggest Change</a></li> -->
|
||||
<li><a href="{{ package.getCreateEditRequestURL() }}">Suggest Changes</a></li>
|
||||
{% endif %}
|
||||
{% if package.checkPerm(current_user, "MAKE_RELEASE") %}
|
||||
<li><a href="{{ package.getCreateReleaseURL() }}">Create Release</a></li>
|
||||
|
@ -266,10 +266,6 @@ def create_edit_editrequest_page(package, id=None):
|
||||
if erequest.package != package:
|
||||
abort(404)
|
||||
|
||||
from copy import copy
|
||||
edited_package = copy(package)
|
||||
erequest.applyAll(edited_package)
|
||||
|
||||
if not erequest.checkPerm(current_user, Permission.EDIT_EDITREQUEST):
|
||||
abort(403)
|
||||
|
||||
@ -277,6 +273,9 @@ def create_edit_editrequest_page(package, id=None):
|
||||
flash("Can't edit EditRequest, it has already been merged or rejected", "error")
|
||||
return redirect(erequest.getURL())
|
||||
|
||||
edited_package = Package(package)
|
||||
erequest.applyAll(edited_package)
|
||||
|
||||
|
||||
form = EditRequestForm(request.form, obj=edited_package)
|
||||
if request.method == "POST" and form.validate():
|
||||
|
Loading…
Reference in New Issue
Block a user