From 7c3488958676eabbd13d7636bd6a0cab770b322e Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Tue, 5 Jan 2021 10:46:07 -0800 Subject: [PATCH 1/5] Fixes html formatting for registration closed text --- bookwyrm/templates/discover.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bookwyrm/templates/discover.html b/bookwyrm/templates/discover.html index ee531f17b..79e31f564 100644 --- a/bookwyrm/templates/discover.html +++ b/bookwyrm/templates/discover.html @@ -13,7 +13,7 @@
-
+
{% if site.allow_registration %}

Join {{ site.name }}

@@ -21,7 +21,7 @@
{% else %}

This instance is closed

-

{{ site.registration_closed_text }}

+

{{ site.registration_closed_text | safe}}

{% endif %}
From 11212401a0bb3ee796ba6fe029bd9f118ed73bbf Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Tue, 5 Jan 2021 11:08:24 -0800 Subject: [PATCH 2/5] Add created date and sorting to invites --- bookwyrm/models/site.py | 1 + bookwyrm/views.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/bookwyrm/models/site.py b/bookwyrm/models/site.py index f31e84949..4670bd948 100644 --- a/bookwyrm/models/site.py +++ b/bookwyrm/models/site.py @@ -50,6 +50,7 @@ def new_access_code(): class SiteInvite(models.Model): ''' gives someone access to create an account on the instance ''' + created_date = models.DateTimeField(auto_now_add=True) code = models.CharField(max_length=32, default=new_access_code) expiry = models.DateTimeField(blank=True, null=True) use_limit = models.IntegerField(blank=True, null=True) diff --git a/bookwyrm/views.py b/bookwyrm/views.py index 9a6461de3..fad71ccf3 100644 --- a/bookwyrm/views.py +++ b/bookwyrm/views.py @@ -399,7 +399,8 @@ def manage_invites(request): ''' invite management page ''' data = { 'title': 'Invitations', - 'invites': models.SiteInvite.objects.filter(user=request.user), + 'invites': models.SiteInvite.objects.filter( + user=request.user).order_by('-created_date'), 'form': forms.CreateInviteForm(), } return TemplateResponse(request, 'manage_invites.html', data) From 3d6f11354387a92f4726d6274beebbf64f42d110 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Tue, 5 Jan 2021 11:16:24 -0800 Subject: [PATCH 3/5] Fixes bug that shows your own posts in every user page --- bookwyrm/views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bookwyrm/views.py b/bookwyrm/views.py index fad71ccf3..413039b4f 100644 --- a/bookwyrm/views.py +++ b/bookwyrm/views.py @@ -467,9 +467,9 @@ def user_page(request, username): # user's posts activities = get_activity_feed( - user, + request.user, ['public', 'unlisted', 'followers'], - queryset=models.Status.objects.filter(user=request.user) + queryset=models.Status.objects.filter(user=user) ) paginated = Paginator(activities, PAGE_LENGTH) activity_page = paginated.page(page) From 5864c9a6e785677fb148d578cea4a2a9b3e67fb9 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Tue, 5 Jan 2021 11:33:33 -0800 Subject: [PATCH 4/5] Revert "Add created date and sorting to invites" This reverts commit 11212401a0bb3ee796ba6fe029bd9f118ed73bbf. --- bookwyrm/models/site.py | 1 - bookwyrm/views.py | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/bookwyrm/models/site.py b/bookwyrm/models/site.py index 4670bd948..f31e84949 100644 --- a/bookwyrm/models/site.py +++ b/bookwyrm/models/site.py @@ -50,7 +50,6 @@ def new_access_code(): class SiteInvite(models.Model): ''' gives someone access to create an account on the instance ''' - created_date = models.DateTimeField(auto_now_add=True) code = models.CharField(max_length=32, default=new_access_code) expiry = models.DateTimeField(blank=True, null=True) use_limit = models.IntegerField(blank=True, null=True) diff --git a/bookwyrm/views.py b/bookwyrm/views.py index fad71ccf3..9a6461de3 100644 --- a/bookwyrm/views.py +++ b/bookwyrm/views.py @@ -399,8 +399,7 @@ def manage_invites(request): ''' invite management page ''' data = { 'title': 'Invitations', - 'invites': models.SiteInvite.objects.filter( - user=request.user).order_by('-created_date'), + 'invites': models.SiteInvite.objects.filter(user=request.user), 'form': forms.CreateInviteForm(), } return TemplateResponse(request, 'manage_invites.html', data) From c8d53ee0df56f7f451bc05a47a57e31e5552f81a Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Tue, 5 Jan 2021 11:37:48 -0800 Subject: [PATCH 5/5] Adds site invite created date --- .../0033_siteinvite_created_date.py | 20 +++++++++++++++++++ bookwyrm/models/site.py | 1 + bookwyrm/views.py | 3 ++- 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 bookwyrm/migrations/0033_siteinvite_created_date.py diff --git a/bookwyrm/migrations/0033_siteinvite_created_date.py b/bookwyrm/migrations/0033_siteinvite_created_date.py new file mode 100644 index 000000000..9a3f98963 --- /dev/null +++ b/bookwyrm/migrations/0033_siteinvite_created_date.py @@ -0,0 +1,20 @@ +# Generated by Django 3.0.7 on 2021-01-05 19:08 + +from django.db import migrations, models +import django.utils.timezone + + +class Migration(migrations.Migration): + + dependencies = [ + ('bookwyrm', '0032_auto_20210104_2055'), + ] + + operations = [ + migrations.AddField( + model_name='siteinvite', + name='created_date', + field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now), + preserve_default=False, + ), + ] diff --git a/bookwyrm/models/site.py b/bookwyrm/models/site.py index f31e84949..4670bd948 100644 --- a/bookwyrm/models/site.py +++ b/bookwyrm/models/site.py @@ -50,6 +50,7 @@ def new_access_code(): class SiteInvite(models.Model): ''' gives someone access to create an account on the instance ''' + created_date = models.DateTimeField(auto_now_add=True) code = models.CharField(max_length=32, default=new_access_code) expiry = models.DateTimeField(blank=True, null=True) use_limit = models.IntegerField(blank=True, null=True) diff --git a/bookwyrm/views.py b/bookwyrm/views.py index 9a6461de3..fad71ccf3 100644 --- a/bookwyrm/views.py +++ b/bookwyrm/views.py @@ -399,7 +399,8 @@ def manage_invites(request): ''' invite management page ''' data = { 'title': 'Invitations', - 'invites': models.SiteInvite.objects.filter(user=request.user), + 'invites': models.SiteInvite.objects.filter( + user=request.user).order_by('-created_date'), 'form': forms.CreateInviteForm(), } return TemplateResponse(request, 'manage_invites.html', data)