forked from mirrors/bookwyrm
commit
3e0956d95a
6 changed files with 23 additions and 3 deletions
|
@ -51,7 +51,7 @@ class CommentForm(ModelForm):
|
||||||
class EditUserForm(ModelForm):
|
class EditUserForm(ModelForm):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = models.User
|
model = models.User
|
||||||
fields = ['avatar', 'name', 'summary']
|
fields = ['avatar', 'name', 'summary', 'manually_approves_followers']
|
||||||
help_texts = {f: None for f in fields}
|
help_texts = {f: None for f in fields}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -214,6 +214,7 @@ def handle_incoming_follow(activity):
|
||||||
return HttpResponse()
|
return HttpResponse()
|
||||||
|
|
||||||
create_notification(to_follow, 'FOLLOW', related_user=user)
|
create_notification(to_follow, 'FOLLOW', related_user=user)
|
||||||
|
if not to_follow.manually_approves_followers:
|
||||||
outgoing.handle_outgoing_accept(user, to_follow, activity)
|
outgoing.handle_outgoing_accept(user, to_follow, activity)
|
||||||
return HttpResponse()
|
return HttpResponse()
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
# Generated by Django 3.0.3 on 2020-03-09 20:09
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('fedireads', '0012_auto_20200308_1625'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='user',
|
||||||
|
name='manually_approves_followers',
|
||||||
|
field=models.BooleanField(default=False),
|
||||||
|
),
|
||||||
|
]
|
|
@ -50,6 +50,7 @@ class User(AbstractUser):
|
||||||
)
|
)
|
||||||
created_date = models.DateTimeField(auto_now_add=True)
|
created_date = models.DateTimeField(auto_now_add=True)
|
||||||
updated_date = models.DateTimeField(auto_now=True)
|
updated_date = models.DateTimeField(auto_now=True)
|
||||||
|
manually_approves_followers = models.BooleanField(default=False)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def absolute_id(self):
|
def absolute_id(self):
|
||||||
|
|
|
@ -23,6 +23,7 @@ def edit_profile(request):
|
||||||
if 'avatar' in form.files:
|
if 'avatar' in form.files:
|
||||||
request.user.avatar = form.files['avatar']
|
request.user.avatar = form.files['avatar']
|
||||||
request.user.summary = form.data['summary']
|
request.user.summary = form.data['summary']
|
||||||
|
request.user.manually_approves_followers = form.cleaned_data['manually_approves_followers']
|
||||||
request.user.save()
|
request.user.save()
|
||||||
return redirect('/user/%s' % request.user.localname)
|
return redirect('/user/%s' % request.user.localname)
|
||||||
|
|
||||||
|
|
|
@ -148,7 +148,6 @@ def notifications_page(request):
|
||||||
return TemplateResponse(request, 'notifications.html', data)
|
return TemplateResponse(request, 'notifications.html', data)
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
|
||||||
def user_page(request, username):
|
def user_page(request, username):
|
||||||
''' profile page for a user '''
|
''' profile page for a user '''
|
||||||
content = request.headers.get('Accept')
|
content = request.headers.get('Accept')
|
||||||
|
|
Loading…
Reference in a new issue