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