From 9a20b5dbd5d31d216c7f7456359edba2cca601f7 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Thu, 18 Mar 2021 09:00:25 -0700 Subject: [PATCH 1/5] Hide goal using database field instead of localstorage --- bookwyrm/migrations/0052_user_show_goal.py | 18 ++++++++++++++++++ bookwyrm/models/user.py | 1 + bookwyrm/templates/feed/feed.html | 4 ++-- bookwyrm/templates/snippets/goal_card.html | 7 ++++--- bookwyrm/urls.py | 2 ++ bookwyrm/views/__init__.py | 2 +- bookwyrm/views/goal.py | 10 ++++++++++ 7 files changed, 38 insertions(+), 6 deletions(-) create mode 100644 bookwyrm/migrations/0052_user_show_goal.py diff --git a/bookwyrm/migrations/0052_user_show_goal.py b/bookwyrm/migrations/0052_user_show_goal.py new file mode 100644 index 000000000..4455e0483 --- /dev/null +++ b/bookwyrm/migrations/0052_user_show_goal.py @@ -0,0 +1,18 @@ +# Generated by Django 3.0.7 on 2021-03-18 15:51 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('bookwyrm', '0051_auto_20210316_1950'), + ] + + operations = [ + migrations.AddField( + model_name='user', + name='show_goal', + field=models.BooleanField(default=True), + ), + ] diff --git a/bookwyrm/models/user.py b/bookwyrm/models/user.py index 440b65d3d..46f08509f 100644 --- a/bookwyrm/models/user.py +++ b/bookwyrm/models/user.py @@ -102,6 +102,7 @@ class User(OrderedCollectionPageMixin, AbstractUser): updated_date = models.DateTimeField(auto_now=True) last_active_date = models.DateTimeField(auto_now=True) manually_approves_followers = fields.BooleanField(default=False) + show_goal = models.BooleanField(default=True) name_field = "username" diff --git a/bookwyrm/templates/feed/feed.html b/bookwyrm/templates/feed/feed.html index 4eb363e4a..13533f72d 100644 --- a/bookwyrm/templates/feed/feed.html +++ b/bookwyrm/templates/feed/feed.html @@ -19,9 +19,9 @@ {# announcements and system messages #} -{% if not goal and tab == 'home' %} +{% if request.user.show_goal and not goal and tab == 'home' %} {% now 'Y' as year %} -