From 67661274a6accd8b195679864d691e5f94c9d57c Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Tue, 10 Mar 2020 11:23:23 -0700 Subject: [PATCH] Fixes bug in remote user absolute_id generator --- fedireads/models/user.py | 3 ++- fedireads/templates/notifications.html | 2 +- fedireads/views.py | 8 ++++---- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/fedireads/models/user.py b/fedireads/models/user.py index 23df60bed..2fa9fec06 100644 --- a/fedireads/models/user.py +++ b/fedireads/models/user.py @@ -56,7 +56,8 @@ class User(AbstractUser): def absolute_id(self): ''' users are identified by their username, so overriding this prop ''' model_name = type(self).__name__.lower() - return 'https://%s/%s/%s' % (DOMAIN, model_name, self.localname) + username = self.localname or self.username + return 'https://%s/%s/%s' % (DOMAIN, model_name, username) class UserRelationship(FedireadsModel): diff --git a/fedireads/templates/notifications.html b/fedireads/templates/notifications.html index 91b98b403..e203fde0e 100644 --- a/fedireads/templates/notifications.html +++ b/fedireads/templates/notifications.html @@ -9,7 +9,7 @@ {% for notification in notifications %} -
+

{% if notification.notification_type == 'FAVORITE' %} {% include 'snippets/username.html' with user=notification.related_user %} diff --git a/fedireads/views.py b/fedireads/views.py index b357cc11d..3d35d131d 100644 --- a/fedireads/views.py +++ b/fedireads/views.py @@ -141,10 +141,12 @@ def register(request): def notifications_page(request): ''' list notitications ''' + notifications = request.user.notification_set.all() \ + .order_by('-created_date') data = { - 'notifications': request.user.notification_set.all().order_by('-created_date') + 'notifications': notifications, } - request.user.notification_set.update(read=True) + notifications.update(read=True) return TemplateResponse(request, 'notifications.html', data) @@ -176,7 +178,6 @@ def user_page(request, username): return TemplateResponse(request, 'user.html', data) -@login_required def status_page(request, username, status_id): ''' display a particular status (and replies, etc) ''' content = request.headers.get('Accept') @@ -211,7 +212,6 @@ def edit_profile_page(request): return TemplateResponse(request, 'edit_user.html', data) -@login_required def book_page(request, book_identifier, tab='friends'): ''' info about a book ''' book = books_manager.get_or_create_book(book_identifier)