From 09150a4dbb74e9fb0d9fe4bdc5ced3ac246cd0e9 Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Tue, 25 Dec 2018 17:51:29 +0000 Subject: Allow users to discard their own topics --- app/templates/macros/topics.html | 4 ++-- app/templates/todo/topics.html | 34 ++---------------------------- app/templates/users/user_profile_page.html | 11 +++++++++- 3 files changed, 14 insertions(+), 35 deletions(-) (limited to 'app/templates') diff --git a/app/templates/macros/topics.html b/app/templates/macros/topics.html index 8316a70..432867d 100644 --- a/app/templates/macros/topics.html +++ b/app/templates/macros/topics.html @@ -1,4 +1,4 @@ -{% macro render_topics_table(topics, show_author=True, show_discard=False) -%} +{% macro render_topics_table(topics, show_author=True, show_discard=False, current_user=current_user) -%} @@ -27,7 +27,7 @@ href="{{ url_for('create_edit_package_page', author=topic.author.username, repo=topic.getRepoURL(), forums=topic.topic_id, title=topic.title, bname=topic.name) }}"> Create - {% if show_discard %} + {% if show_discard and current_user.is_authenticated and topic.checkPerm(current_user, "TOPIC_DISCARD") %} {% if topic.discarded %} Show diff --git a/app/templates/todo/topics.html b/app/templates/todo/topics.html index 5d3e7f9..b112254 100644 --- a/app/templates/todo/topics.html +++ b/app/templates/todo/topics.html @@ -59,7 +59,7 @@ Topics to be Added {% from "macros/topics.html" import render_topics_table %} - {{ render_topics_table(topics, show_discard=True) }} + {{ render_topics_table(topics, show_discard=True, current_user=current_user) }}