From ae3f5a0f625e64f6ad2f44f939a11ee3a63a0d2a Mon Sep 17 00:00:00 2001 From: Ariel Rin Date: Thu, 4 Jun 2020 11:21:50 +0000 Subject: [PATCH] Revert "Merge branch 'notifications_refresh' into 'master'" This reverts merge request !1215 --- allianceauth/authentication/urls.py | 6 +---- allianceauth/authentication/views.py | 12 +-------- allianceauth/static/js/base.js | 27 ------------------- allianceauth/templates/allianceauth/base.html | 1 - .../allianceauth/notifications_menu_item.html | 9 ------- .../templates/allianceauth/top-menu.html | 20 +++++++------- 6 files changed, 12 insertions(+), 63 deletions(-) delete mode 100644 allianceauth/static/js/base.js delete mode 100644 allianceauth/templates/allianceauth/notifications_menu_item.html diff --git a/allianceauth/authentication/urls.py b/allianceauth/authentication/urls.py index 60f89cdc..11fee0b9 100644 --- a/allianceauth/authentication/urls.py +++ b/allianceauth/authentication/urls.py @@ -1,4 +1,5 @@ from django.conf.urls import url +from django.contrib.auth.decorators import login_required from django.views.generic.base import TemplateView from . import views @@ -23,9 +24,4 @@ urlpatterns = [ name='add_character' ), url(r'^dashboard/$', views.dashboard, name='dashboard'), - url( - r'^notifications_render/$', - views.notifications_render, - name='notifications_render' - ), ] diff --git a/allianceauth/authentication/views.py b/allianceauth/authentication/views.py index d50ba245..98b93a62 100644 --- a/allianceauth/authentication/views.py +++ b/allianceauth/authentication/views.py @@ -6,13 +6,11 @@ from django.contrib.auth import login, authenticate from django.contrib.auth.decorators import login_required from django.contrib.auth.models import User from django.core import signing -from django.http import HttpResponse -from django.shortcuts import redirect, render from django.urls import reverse +from django.shortcuts import redirect, render from django.utils.translation import gettext_lazy as _ from allianceauth.eveonline.models import EveCharacter - from esi.decorators import token_required from esi.models import Token @@ -61,14 +59,6 @@ def dashboard(request): return render(request, 'authentication/dashboard.html', context) -@login_required -def notifications_render(request): - """returns html to render the notifications item in the top menu""" - unread_count = request.user.notification_set.filter(viewed=False).count() - context = {'notifications': unread_count} - return render(request, 'allianceauth/notifications_menu_item.html', context) - - @login_required @token_required(scopes=settings.LOGIN_TOKEN_SCOPES) def main_character_change(request, token): diff --git a/allianceauth/static/js/base.js b/allianceauth/static/js/base.js deleted file mode 100644 index e8b64b45..00000000 --- a/allianceauth/static/js/base.js +++ /dev/null @@ -1,27 +0,0 @@ -/* - Javascript for the base template -*/ - -$(function() { - var elem = document.getElementById("dataExport"); - var notificationsRenderUrl = elem.getAttribute("data-notificationsRenderUrl"); - - // render the notifications item in the top menu - function render_notifications(){ - $("#menu_item_notifications").load( - notificationsRenderUrl, - function(responseTxt, statusTxt, xhr){ - if(statusTxt == "error") - console.log( - "Failed to load HTMl to render notifications item. Error: " - + xhr.status - + ": " - + xhr.statusText - ); - }); - } - render_notifications() - - // re-render notifications every x seconds - setInterval(render_notifications, 5000); -}); diff --git a/allianceauth/templates/allianceauth/base.html b/allianceauth/templates/allianceauth/base.html index 2a9b1633..ee7db14d 100644 --- a/allianceauth/templates/allianceauth/base.html +++ b/allianceauth/templates/allianceauth/base.html @@ -45,7 +45,6 @@ {% endif %} {% include 'bundles/bootstrap-js.html' %} {% block extra_javascript %} - {% endblock extra_javascript %}