From fd7c1e5dd89fb15d2880e35e84053ddf118edcf8 Mon Sep 17 00:00:00 2001
From: Eliot Berriot <contact@eliotberriot.com>
Date: Thu, 1 Mar 2018 20:36:29 +0100
Subject: [PATCH] Added privacy level for user

---
 .../migrations/0004_user_privacy_level.py      | 18 ++++++++++++++++++
 api/funkwhale_api/users/models.py              | 11 +++++++++++
 2 files changed, 29 insertions(+)
 create mode 100644 api/funkwhale_api/users/migrations/0004_user_privacy_level.py

diff --git a/api/funkwhale_api/users/migrations/0004_user_privacy_level.py b/api/funkwhale_api/users/migrations/0004_user_privacy_level.py
new file mode 100644
index 000000000..81891eb0f
--- /dev/null
+++ b/api/funkwhale_api/users/migrations/0004_user_privacy_level.py
@@ -0,0 +1,18 @@
+# Generated by Django 2.0.2 on 2018-03-01 19:30
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('users', '0003_auto_20171226_1357'),
+    ]
+
+    operations = [
+        migrations.AddField(
+            model_name='user',
+            name='privacy_level',
+            field=models.CharField(choices=[('me', 'Only me'), ('followers', 'Me and my followers'), ('instance', 'Everyone on my instance, and my followers'), ('everyone', 'Everyone, including people on other instances')], default='instance', max_length=30),
+        ),
+    ]
diff --git a/api/funkwhale_api/users/models.py b/api/funkwhale_api/users/models.py
index 2b0dfa888..a5478656b 100644
--- a/api/funkwhale_api/users/models.py
+++ b/api/funkwhale_api/users/models.py
@@ -11,6 +11,14 @@ from django.utils.encoding import python_2_unicode_compatible
 from django.utils.translation import ugettext_lazy as _
 
 
+
+PRIVACY_LEVEL_CHOICES = [
+    ('me', 'Only me'),
+    ('followers', 'Me and my followers'),
+    ('instance', 'Everyone on my instance, and my followers'),
+    ('everyone', 'Everyone, including people on other instances'),
+]
+
 @python_2_unicode_compatible
 class User(AbstractUser):
 
@@ -31,6 +39,9 @@ class User(AbstractUser):
         },
     }
 
+    privacy_level = models.CharField(
+        max_length=30, choices=PRIVACY_LEVEL_CHOICES, default='instance')
+
     def __str__(self):
         return self.username
 
-- 
GitLab