diff --git a/bookwyrm/forms.py b/bookwyrm/forms.py index ba2fcc8c..19f692db 100644 --- a/bookwyrm/forms.py +++ b/bookwyrm/forms.py @@ -103,7 +103,7 @@ class EditUserForm(CustomForm): class Meta: model = models.User fields = [ - 'avatar', 'name', 'email', 'summary', 'manually_approves_followers' + 'avatar', 'name', 'email', 'summary', 'manually_approves_followers', 'default_post_privacy' ] help_texts = {f: None for f in fields} diff --git a/bookwyrm/migrations/0046_user_default_post_privacy.py b/bookwyrm/migrations/0046_user_default_post_privacy.py new file mode 100644 index 00000000..3f225472 --- /dev/null +++ b/bookwyrm/migrations/0046_user_default_post_privacy.py @@ -0,0 +1,18 @@ +# Generated by Django 3.0.7 on 2021-02-14 00:39 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('bookwyrm', '0045_auto_20210210_2114'), + ] + + operations = [ + migrations.AddField( + model_name='user', + name='default_post_privacy', + field=models.CharField(choices=[('public', 'Public'), ('unlisted', 'Unlisted'), ('followers', 'Followers'), ('direct', 'Direct')], default='public', max_length=255), + ), + ] diff --git a/bookwyrm/models/user.py b/bookwyrm/models/user.py index da717d2e..fe21b58f 100644 --- a/bookwyrm/models/user.py +++ b/bookwyrm/models/user.py @@ -22,7 +22,6 @@ from .base_model import BookWyrmModel from .federated_server import FederatedServer from . import fields, Review - class User(OrderedCollectionPageMixin, AbstractUser): ''' a user who wants to read books ''' username = fields.UsernameField() @@ -91,6 +90,11 @@ class User(OrderedCollectionPageMixin, AbstractUser): through_fields=('user', 'status'), related_name='favorite_statuses' ) + default_post_privacy = models.CharField( + max_length=255, + default='public', + choices=fields.PrivacyLevels.choices + ) remote_id = fields.RemoteIdField( null=True, unique=True, activitypub_field='id') created_date = models.DateTimeField(auto_now_add=True) diff --git a/bookwyrm/templates/preferences/edit_user.html b/bookwyrm/templates/preferences/edit_user.html index 798d2fcb..fc490b96 100644 --- a/bookwyrm/templates/preferences/edit_user.html +++ b/bookwyrm/templates/preferences/edit_user.html @@ -43,6 +43,12 @@ Edit Profile {{ form.manually_approves_followers }} +
+ +
{% endblock %} diff --git a/bookwyrm/templates/snippets/privacy_select.html b/bookwyrm/templates/snippets/privacy_select.html index a771c3d6..aabdc8df 100644 --- a/bookwyrm/templates/snippets/privacy_select.html +++ b/bookwyrm/templates/snippets/privacy_select.html @@ -5,16 +5,16 @@ {% endif %}