mirror of
https://github.com/minetest/contentdb.git
synced 2024-11-10 09:33:44 +01:00
parent
1b42f3310a
commit
28ee65809e
@ -85,9 +85,10 @@ class Permission(enum.Enum):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
if self == Permission.APPROVE_NEW or \
|
if self == Permission.APPROVE_NEW or \
|
||||||
self == Permission.APPROVE_CHANGES or \
|
self == Permission.APPROVE_CHANGES or \
|
||||||
self == Permission.APPROVE_RELEASE or \
|
self == Permission.APPROVE_RELEASE or \
|
||||||
self == Permission.APPROVE_SCREENSHOT:
|
self == Permission.APPROVE_SCREENSHOT or \
|
||||||
|
self == Permission.SEE_THREAD:
|
||||||
return user.rank.atLeast(UserRank.EDITOR)
|
return user.rank.atLeast(UserRank.EDITOR)
|
||||||
else:
|
else:
|
||||||
raise Exception("Non-global permission checked globally. Use Package.checkPerm or User.checkPerm instead.")
|
raise Exception("Non-global permission checked globally. Use Package.checkPerm or User.checkPerm instead.")
|
||||||
|
@ -29,6 +29,8 @@
|
|||||||
<ul>
|
<ul>
|
||||||
{% for t in threads %}
|
{% for t in threads %}
|
||||||
<li><a href="{{ url_for('thread_page', id=t.id) }}">{{ t.title }}</a> by {{ t.author.display_name }}</li>
|
<li><a href="{{ url_for('thread_page', id=t.id) }}">{{ t.title }}</a> by {{ t.author.display_name }}</li>
|
||||||
|
{% else %}
|
||||||
|
<li><i>No threads found</i></li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
@ -37,11 +37,11 @@ def build_packages_query():
|
|||||||
type = PackageType[type_name.upper()]
|
type = PackageType[type_name.upper()]
|
||||||
|
|
||||||
title = "Packages"
|
title = "Packages"
|
||||||
query = Package.query.filter_by(soft_deleted=False)
|
query = Package.query.filter_by(soft_deleted=False, approved=True)
|
||||||
|
|
||||||
if type is not None:
|
if type is not None:
|
||||||
title = type.value + "s"
|
title = type.value + "s"
|
||||||
query = query.filter_by(type=type, approved=True)
|
query = query.filter_by(type=type)
|
||||||
|
|
||||||
search = request.args.get("q")
|
search = request.args.get("q")
|
||||||
if search is not None and search.strip() != "":
|
if search is not None and search.strip() != "":
|
||||||
|
@ -27,8 +27,10 @@ from wtforms.validators import *
|
|||||||
|
|
||||||
@app.route("/threads/")
|
@app.route("/threads/")
|
||||||
def threads_page():
|
def threads_page():
|
||||||
threads = Thread.query.filter_by(private=False).all()
|
query = Thread.query
|
||||||
return render_template("threads/list.html", threads=threads)
|
if not Permission.SEE_THREAD.check(current_user):
|
||||||
|
query = query.filter_by(private=False)
|
||||||
|
return render_template("threads/list.html", threads=query.all())
|
||||||
|
|
||||||
@app.route("/threads/<int:id>/", methods=["GET", "POST"])
|
@app.route("/threads/<int:id>/", methods=["GET", "POST"])
|
||||||
def thread_page(id):
|
def thread_page(id):
|
||||||
|
Loading…
Reference in New Issue
Block a user