diff --git a/app/models.py b/app/models.py
index 281867c..ef26bbd 100644
--- a/app/models.py
+++ b/app/models.py
@@ -77,6 +77,7 @@ class Permission(enum.Enum):
CHANGE_EMAIL = "CHANGE_EMAIL"
EDIT_EDITREQUEST = "EDIT_EDITREQUEST"
SEE_THREAD = "SEE_THREAD"
+ CREATE_THREAD = "CREATE_THREAD"
# Only return true if the permission is valid for *all* contexts
# See Package.checkPerm for package-specific contexts
@@ -480,7 +481,7 @@ class Package(db.Model):
isOwner = user == self.author
# Members can edit their own packages, and editors can edit any packages
- if perm == Permission.MAKE_RELEASE or perm == Permission.ADD_SCREENSHOTS:
+ if perm == Permission.MAKE_RELEASE or perm == Permission.ADD_SCREENSHOTS or perm == Permission.CREATE_THREAD:
return isOwner or user.rank.atLeast(UserRank.EDITOR)
if perm == Permission.EDIT_PACKAGE or perm == Permission.APPROVE_CHANGES:
diff --git a/app/templates/macros/threads.html b/app/templates/macros/threads.html
index 023059a..cdb6b4f 100644
--- a/app/templates/macros/threads.html
+++ b/app/templates/macros/threads.html
@@ -28,7 +28,7 @@
{% macro render_threadlist(threads) -%}
{% for t in threads %}
- - {{ t.title }} by {{ t.author.display_name }}
+ - {% if t.private %}🔒 {% endif %}{{ t.title }} by {{ t.author.display_name }}
{% else %}
- No threads found
{% endfor %}
diff --git a/app/templates/packages/view.html b/app/templates/packages/view.html
index 4bcc1cd..01cc474 100644
--- a/app/templates/packages/view.html
+++ b/app/templates/packages/view.html
@@ -171,6 +171,9 @@
{% if package.checkPerm(current_user, "MAKE_RELEASE") %}
- Create Release
{% endif %}
+ {% if package.approved and package.checkPerm(current_user, "CREATE_THREAD") %}
+ - Open Thread
+ {% endif %}
{% if package.checkPerm(current_user, "DELETE_PACKAGE") %}
- Delete
{% endif %}
@@ -319,6 +322,10 @@
{% if threads %}
Threads
+ {% if package.approved and package.checkPerm(current_user, "CREATE_THREAD") %}
+ Open Thread
+ {% endif %}
+
{% from "macros/threads.html" import render_threadlist %}
{{ render_threadlist(threads) }}
{% endif %}
diff --git a/app/views/threads.py b/app/views/threads.py
index 2aa815e..316ca4d 100644
--- a/app/views/threads.py
+++ b/app/views/threads.py
@@ -92,7 +92,7 @@ def new_thread_page():
flash("Unable to find that package!", "error")
# Don't allow making threads on approved packages for now
- if package is None or package.approved:
+ if package is None:
abort(403)
def_is_private = request.args.get("private") or False
@@ -102,8 +102,7 @@ def new_thread_page():
is_review_thread = package is not None and not package.approved
# Check that user can make the thread
- if is_review_thread and not (package.author == current_user or \
- package.checkPerm(current_user, Permission.APPROVE_NEW)):
+ if not package.checkPerm(current_user, Permission.CREATE_THREAD):
flash("Unable to create thread!", "error")
return redirect(url_for("home_page"))