diff --git a/bookwyrm/templates/directory.html b/bookwyrm/templates/directory.html index 9323752f..9e1cfae9 100644 --- a/bookwyrm/templates/directory.html +++ b/bookwyrm/templates/directory.html @@ -11,6 +11,23 @@ {% trans "Directory" %} + +{% if not request.user.discoverable %} +
+ {% url 'settings-profile' as path %} +

+ {% trans "Make your profile discoverable so other BookWyrm users can find you." %} +

+
+ {% csrf_token %} + +

+ {% blocktrans %}You can opt-out at any time in your profile settings{% endblocktrans %} +

+
+
+{% endif %} +
{% for user in users %}
diff --git a/bookwyrm/views/directory.py b/bookwyrm/views/directory.py index cc21baf2..addb85c2 100644 --- a/bookwyrm/views/directory.py +++ b/bookwyrm/views/directory.py @@ -1,6 +1,7 @@ """ who all's here? """ from django.contrib.auth.decorators import login_required from django.core.paginator import Paginator +from django.shortcuts import redirect from django.template.response import TemplateResponse from django.views import View from django.utils.decorators import method_decorator @@ -30,3 +31,9 @@ class Directory(View): "users": paginated.page(page), } return TemplateResponse(request, "directory.html", data) + + def post(self, request): + """ join the directory """ + request.user.discoverable = True + request.user.save() + return redirect('directory')