From 96cc9d44db479901b8307cbc5b3b205aa0773711 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Mon, 18 Jan 2021 11:57:20 -0800 Subject: [PATCH] Fixes email migration --- ...0118_1900.py => 0037_auto_20210118_1954.py} | 4 ++-- bookwyrm/migrations/0038_auto_20210118_1951.py | 18 ------------------ bookwyrm/views/helpers.py | 2 ++ 3 files changed, 4 insertions(+), 20 deletions(-) rename bookwyrm/migrations/{0037_auto_20210118_1900.py => 0037_auto_20210118_1954.py} (76%) delete mode 100644 bookwyrm/migrations/0038_auto_20210118_1951.py diff --git a/bookwyrm/migrations/0037_auto_20210118_1900.py b/bookwyrm/migrations/0037_auto_20210118_1954.py similarity index 76% rename from bookwyrm/migrations/0037_auto_20210118_1900.py rename to bookwyrm/migrations/0037_auto_20210118_1954.py index 9b26c411..9da0265d 100644 --- a/bookwyrm/migrations/0037_auto_20210118_1900.py +++ b/bookwyrm/migrations/0037_auto_20210118_1954.py @@ -1,4 +1,4 @@ -# Generated by Django 3.0.7 on 2021-01-18 19:00 +# Generated by Django 3.0.7 on 2021-01-18 19:54 from django.db import migrations, models @@ -17,6 +17,6 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='user', name='email', - field=models.EmailField(max_length=254, unique=True), + field=models.EmailField(max_length=254, null=True, unique=True), ), ] diff --git a/bookwyrm/migrations/0038_auto_20210118_1951.py b/bookwyrm/migrations/0038_auto_20210118_1951.py deleted file mode 100644 index 10ca5295..00000000 --- a/bookwyrm/migrations/0038_auto_20210118_1951.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 3.0.7 on 2021-01-18 19:51 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('bookwyrm', '0037_auto_20210118_1900'), - ] - - operations = [ - migrations.AlterField( - model_name='user', - name='email', - field=models.EmailField(max_length=254, null=True, unique=True), - ), - ] diff --git a/bookwyrm/views/helpers.py b/bookwyrm/views/helpers.py index 354b8bf6..60159324 100644 --- a/bookwyrm/views/helpers.py +++ b/bookwyrm/views/helpers.py @@ -36,6 +36,8 @@ def is_bookworm_request(request): def object_visible_to_user(viewer, obj): ''' is a user authorized to view an object? ''' + if not obj: + return False if viewer == obj.user or obj.privacy in ['public', 'unlisted']: return True if obj.privacy == 'followers' and \