Fixes bug in remote user absolute_id generator

This commit is contained in:
Mouse Reeve 2020-03-10 11:23:23 -07:00
parent 787aa4691d
commit 67661274a6
3 changed files with 7 additions and 6 deletions

View file

@ -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):

View file

@ -9,7 +9,7 @@
<button type="submit">Delete notifications</button>
</form>
{% for notification in notifications %}
<div>
<div class="notification{% if not notification.read %}unread{% endif %}">
<p>
{% if notification.notification_type == 'FAVORITE' %}
{% include 'snippets/username.html' with user=notification.related_user %}

View file

@ -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)