forked from mirrors/bookwyrm
Merge pull request #1248 from bookwyrm-social/default-post-privacy
Default post privacy
This commit is contained in:
commit
a13db6adc3
7 changed files with 59 additions and 4 deletions
|
@ -132,6 +132,7 @@ class EditUserForm(CustomForm):
|
|||
"summary",
|
||||
"show_goal",
|
||||
"manually_approves_followers",
|
||||
"default_post_privacy",
|
||||
"discoverable",
|
||||
"preferred_timezone",
|
||||
]
|
||||
|
|
27
bookwyrm/migrations/0046_user_default_post_privacy.py
Normal file
27
bookwyrm/migrations/0046_user_default_post_privacy.py
Normal file
|
@ -0,0 +1,27 @@
|
|||
# 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,
|
||||
),
|
||||
),
|
||||
]
|
13
bookwyrm/migrations/0079_merge_20210804_1746.py
Normal file
13
bookwyrm/migrations/0079_merge_20210804_1746.py
Normal file
|
@ -0,0 +1,13 @@
|
|||
# Generated by Django 3.2.4 on 2021-08-04 17:46
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("bookwyrm", "0046_user_default_post_privacy"),
|
||||
("bookwyrm", "0078_add_shelved_date"),
|
||||
]
|
||||
|
||||
operations = []
|
|
@ -105,6 +105,9 @@ 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)
|
||||
updated_date = models.DateTimeField(auto_now=True)
|
||||
|
|
|
@ -53,6 +53,14 @@
|
|||
{{ form.manually_approves_followers }}
|
||||
</label>
|
||||
</div>
|
||||
<div class="block">
|
||||
<label class="label" for="id_default_post_privacy">
|
||||
{% trans "Default post privacy:" %}
|
||||
</label>
|
||||
<div class="select">
|
||||
{{ form.default_post_privacy }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="block">
|
||||
<label class="checkbox label" for="id_discoverable">
|
||||
{% trans "Show this account in suggested users:" %}
|
||||
|
|
|
@ -5,17 +5,18 @@
|
|||
{% if not no_label %}
|
||||
<label class="is-sr-only" for="privacy-{{ uuid }}">{% trans "Post privacy" %}</label>
|
||||
{% endif %}
|
||||
{% firstof current user.default_post_privacy "public" as privacy %}
|
||||
<select name="privacy" id="privacy-{{ uuid }}">
|
||||
<option value="public" {% if not current or current == 'public' %}selected{% endif %}>
|
||||
<option value="public" {% if privacy == 'public' %}selected{% endif %}>
|
||||
{% trans "Public" %}
|
||||
</option>
|
||||
<option value="unlisted" {% if current == 'unlisted' %}selected{% endif %}>
|
||||
<option value="unlisted" {% if privacy == 'unlisted' %}selected{% endif %}>
|
||||
{% trans "Unlisted" %}
|
||||
</option>
|
||||
<option value="followers" {% if current == 'followers' %}selected{% endif %}>
|
||||
<option value="followers" {% if privacy == 'followers' %}selected{% endif %}>
|
||||
{% trans "Followers" %}
|
||||
</option>
|
||||
<option value="direct" {% if current == 'direct' %}selected{% endif %}>
|
||||
<option value="direct" {% if privacy == 'direct' %}selected{% endif %}>
|
||||
{% trans "Private" %}
|
||||
</option>
|
||||
</select>
|
||||
|
|
|
@ -62,6 +62,7 @@ class EditUserViews(TestCase):
|
|||
form = forms.EditUserForm(instance=self.local_user)
|
||||
form.data["name"] = "New Name"
|
||||
form.data["email"] = "wow@email.com"
|
||||
form.data["default_post_privacy"] = "public"
|
||||
form.data["preferred_timezone"] = "UTC"
|
||||
request = self.factory.post("", form.data)
|
||||
request.user = self.local_user
|
||||
|
@ -81,6 +82,7 @@ class EditUserViews(TestCase):
|
|||
form = forms.EditUserForm(instance=self.local_user)
|
||||
form.data["name"] = "New Name"
|
||||
form.data["email"] = "wow@email.com"
|
||||
form.data["default_post_privacy"] = "public"
|
||||
form.data["preferred_timezone"] = "UTC"
|
||||
image_file = pathlib.Path(__file__).parent.joinpath(
|
||||
"../../static/images/no_cover.jpg"
|
||||
|
|
Loading…
Reference in a new issue