diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/web/templates/feed_list.html | 12 | ||||
-rw-r--r-- | src/web/views/admin.py | 14 |
2 files changed, 21 insertions, 5 deletions
diff --git a/src/web/templates/feed_list.html b/src/web/templates/feed_list.html index 114ae960..2cfab7d8 100644 --- a/src/web/templates/feed_list.html +++ b/src/web/templates/feed_list.html @@ -34,10 +34,14 @@ <td><a href="{{ feed.site_link }}">{{ feed.site_link }}</a></td> <td>( {{ unread_article_count.get(feed.id, 0) }} ) {{ article_count.get(feed.id, 0) }}</td> <td> - <a href="{{ url_for("home", feed_id=feed.id, filter_="all") }}"><i class="glyphicon glyphicon-th-list" title="{{ _('Articles') }}"></i></a> - <a href="{{ url_for("feed.form", feed_id=feed.id) }}"><i class="glyphicon glyphicon-edit" title="{{ _('Edit this feed') }}"></i></a> - <a href="{{ url_for("feed.duplicates", feed_id=feed.id) }}"><i class="glyphicon glyphicon-book" title="{{ _('Duplicate articles') }}"></i></a> - <a href="{{ url_for("feed.delete", feed_id=feed.id) }}"><i class="glyphicon glyphicon-remove" title="{{ _('Delete this feed') }}" onclick="return confirm('{{ _('You are going to delete this feed.') }}');"></i></a> + {% if feed.user_id == current_user.id %} + <a href="{{ url_for("home", feed_id=feed.id, filter_="all") }}"><i class="glyphicon glyphicon-th-list" title="{{ _('Articles') }}"></i></a> + <a href="{{ url_for("feed.form", feed_id=feed.id) }}"><i class="glyphicon glyphicon-edit" title="{{ _('Edit this feed') }}"></i></a> + <a href="{{ url_for("feed.duplicates", feed_id=feed.id) }}"><i class="glyphicon glyphicon-book" title="{{ _('Duplicate articles') }}"></i></a> + <a href="{{ url_for("feed.delete", feed_id=feed.id) }}"><i class="glyphicon glyphicon-remove" title="{{ _('Delete this feed') }}" onclick="return confirm('{{ _('You are going to delete this feed.') }}');"></i></a> + {% else %} + <a href="{{ url_for("admin.delete", feed_id=feed.id) }}"><i class="glyphicon glyphicon-remove" title="{{ _('Delete this feed') }}" onclick="return confirm('{{ _('You are going to delete this feed.') }}');"></i></a> + {% endif %} </td> </tr> {% endfor %} diff --git a/src/web/views/admin.py b/src/web/views/admin.py index ec79262d..753b864f 100644 --- a/src/web/views/admin.py +++ b/src/web/views/admin.py @@ -7,7 +7,7 @@ from flask.ext.principal import Permission, RoleNeed from web.lib.utils import redirect_url from web.models import Role -from web.controllers import UserController, ArticleController +from web.controllers import UserController, ArticleController, FeedController from web.forms import InformationMessageForm, UserForm from web import notifications @@ -130,6 +130,18 @@ def delete_user(user_id=None): '%(error)', error=error), 'danger') return redirect(redirect_url()) +@admin_bp.route('/delete/<feed_id>', methods=['GET']) +@login_required +@admin_permission.require(http_exception=403) +def delete(feed_id=None): + "Deletes the feed of a user." + try: + feed = FeedController().delete(feed_id) + flash(gettext("Feed successfully deleted."), 'success') + except Exception as error: + flash('An error occured while trying to delete a feed: ' + + str(error), 'danger') + return redirect(url_for('home')) @admin_bp.route('/toggle_user/<int:user_id>', methods=['GET']) @login_required |