From 9eba60b0c8e24ef9299ae0a0642e20a2e3593271 Mon Sep 17 00:00:00 2001 From: Joel Bradshaw Date: Sun, 6 Dec 2020 11:15:40 -0800 Subject: [PATCH 1/7] Fix typo in readme, update to bw-dev --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 5e16597c1..5a2378ef3 100644 --- a/README.md +++ b/README.md @@ -114,7 +114,7 @@ This project is still young and isn't, at the momoment, very stable, so please p `cp .env.example .env` - Add your domain, email address, mailgun credentials - Set a secure redis password and secret key - - Update your nginx configuration in `nginx/defautl.conf` + - Update your nginx configuration in `nginx/default.conf` - Replace `your-domain.com` with your domain name - Run the application (this should also set up a Certbot ssl cert for your domain) `docker-compose up --build` @@ -124,13 +124,13 @@ This project is still young and isn't, at the momoment, very stable, so please p - Run docker-compose in the background `docker-compose up -d` - Initialize the database - `./fr-dev initdb` + `./bw-dev initdb` - Congrats! You did it, go to your domain and enjoy the fruits of your labors ### Configure your instance - Register a user account in the applcation UI - Make your account a superuser (warning: do *not* use django's `createsuperuser` command) - On your server, open the django shell - `./fr-dev shell` + `./bw-dev shell` - Load your user and make it a superuser ```python from bookwyrm import models From c9f7cbb9f8757819ce2d79dbfbba4483820921a7 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Wed, 9 Dec 2020 14:49:47 -0800 Subject: [PATCH 2/7] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 5a2378ef3..51e39541d 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ Social reading and reviewing, decentralized with ActivityPub - [The role of federation](#the-role-of-federation) - [Features](#features) - [Setting up the developer environment](#setting-up-the-developer-environment) + - [Installing in Production](#installing-in-production) - [Project structure](#project-structure) - [Book data](#book-data) - [Contributing](#contributing) From 3aba3c8052fce2ef09e69e2669fbb9de460073c6 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Wed, 9 Dec 2020 15:08:53 -0800 Subject: [PATCH 3/7] Create FUNDING.yml --- .github/FUNDING.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 .github/FUNDING.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 000000000..cfbe05241 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] +patreon: bookwrym +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] From adbc8c3f4cdc7fa286e87bd33cb68ac267722fd1 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Fri, 11 Dec 2020 11:26:34 -0800 Subject: [PATCH 4/7] Preview statuses in notifications Fixes #363 --- bookwyrm/templates/notifications.html | 31 +++++++++++++++++++-------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/bookwyrm/templates/notifications.html b/bookwyrm/templates/notifications.html index bc96f307a..f9494c31d 100644 --- a/bookwyrm/templates/notifications.html +++ b/bookwyrm/templates/notifications.html @@ -1,5 +1,6 @@ {% extends 'layout.html' %} -{% load humanize %}l +{% load humanize %} +{% load fr_display %} {% block content %}

Notifications

@@ -12,9 +13,10 @@
{% for notification in notifications %} -
-
+
+

+ {# DESCRIPTION #} {% if notification.related_user %} {% include 'snippets/avatar.html' with user=notification.related_user %} {% include 'snippets/username.html' with user=notification.related_user %} @@ -30,10 +32,8 @@ replied to your status - {% elif notification.notification_type == 'FOLLOW' %} followed you - {% elif notification.notification_type == 'FOLLOW_REQUEST' %} sent you a follow request

@@ -45,17 +45,30 @@ {% endif %} {% else %} your import completed. - {% endif %}

- -

{{ notification.created_date | naturaltime }}

+ {% if notification.related_status %} +
+ {# PREVIEW #} +
+
+ +
+ {{ notification.related_status.published_date | post_date }} + {% include 'snippets/privacy-icons.html' with item=notification.related_status %} +
+
+
+
+ {% endif %}
{% endfor %} + {% if not notifications %}

You're all caught up!

{% endif %}
- {% endblock %} From b33ea40da278649a56fba91cf0fce87b6f1a3751 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Fri, 11 Dec 2020 12:07:37 -0800 Subject: [PATCH 5/7] Use context processor to include site settings in templates --- bookwyrm/settings.py | 1 + bookwyrm/templates/about.html | 4 ++-- bookwyrm/templates/invite.html | 2 +- bookwyrm/templates/layout.html | 17 ++++++++++++----- bookwyrm/templates/login.html | 4 ++-- bookwyrm/templates/password_reset.html | 2 +- bookwyrm/templates/snippets/about.html | 4 ++-- bookwyrm/view_actions.py | 2 -- bookwyrm/views.py | 3 --- 9 files changed, 21 insertions(+), 18 deletions(-) diff --git a/bookwyrm/settings.py b/bookwyrm/settings.py index ecabb8d71..3784158cc 100644 --- a/bookwyrm/settings.py +++ b/bookwyrm/settings.py @@ -75,6 +75,7 @@ TEMPLATES = [ 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', + 'bookwyrm.context_processors.site_settings', ], }, }, diff --git a/bookwyrm/templates/about.html b/bookwyrm/templates/about.html index 25caf5e27..aa7426cad 100644 --- a/bookwyrm/templates/about.html +++ b/bookwyrm/templates/about.html @@ -3,13 +3,13 @@
- {% include 'snippets/about.html' with site_settings=site_settings %} + {% include 'snippets/about.html' %}

Code of Conduct

- {{ site_settings.code_of_conduct | safe }} + {{ site.code_of_conduct | safe }}
diff --git a/bookwyrm/templates/invite.html b/bookwyrm/templates/invite.html index 332a5ed25..42f564d6b 100644 --- a/bookwyrm/templates/invite.html +++ b/bookwyrm/templates/invite.html @@ -15,7 +15,7 @@
- {% include 'snippets/about.html' with site_settings=site_settings %} + {% include 'snippets/about.html' %}
diff --git a/bookwyrm/templates/layout.html b/bookwyrm/templates/layout.html index 4ae70a4bf..a363debda 100644 --- a/bookwyrm/templates/layout.html +++ b/bookwyrm/templates/layout.html @@ -2,7 +2,7 @@ - {% if title %}{{ title }} | {% endif %}BookWyrm + {% if title %}{{ title }} | {% endif %}{{ site.name }} @@ -11,12 +11,10 @@ - - + + - - @@ -123,6 +121,15 @@ {% endblock %}
+ + diff --git a/bookwyrm/templates/login.html b/bookwyrm/templates/login.html index 0142d390a..ce5d9e41c 100644 --- a/bookwyrm/templates/login.html +++ b/bookwyrm/templates/login.html @@ -36,7 +36,7 @@
- {% if site_settings.allow_registration %} + {% if site.allow_registration %}

Create an Account

{% include 'snippets/register_form.html' %} @@ -50,7 +50,7 @@
- {% include 'snippets/about.html' with site_settings=site_settings %} + {% include 'snippets/about.html' %}

More about this site diff --git a/bookwyrm/templates/password_reset.html b/bookwyrm/templates/password_reset.html index ac2ba7bd8..99d114e46 100644 --- a/bookwyrm/templates/password_reset.html +++ b/bookwyrm/templates/password_reset.html @@ -34,7 +34,7 @@

- {% include 'snippets/about.html' with site_settings=site_settings %} + {% include 'snippets/about.html' %}
diff --git a/bookwyrm/templates/snippets/about.html b/bookwyrm/templates/snippets/about.html index 35b39f82f..9660f521b 100644 --- a/bookwyrm/templates/snippets/about.html +++ b/bookwyrm/templates/snippets/about.html @@ -1,7 +1,7 @@ -

About {{ site_settings.name }}

+

About {{ site.name }}

BookWyrm

- {{ site_settings.instance_description }} + {{ site.instance_description }}

diff --git a/bookwyrm/view_actions.py b/bookwyrm/view_actions.py index bb862007d..c3b48b3b3 100644 --- a/bookwyrm/view_actions.py +++ b/bookwyrm/view_actions.py @@ -42,7 +42,6 @@ def user_login(request): login_form.non_field_errors = 'Username or password are incorrect' register_form = forms.RegisterForm() data = { - 'site_settings': models.SiteSettings.get(), 'login_form': login_form, 'register_form': register_form } @@ -78,7 +77,6 @@ def register(request): if errors: data = { - 'site_settings': models.SiteSettings.get(), 'login_form': forms.LoginForm(), 'register_form': form } diff --git a/bookwyrm/views.py b/bookwyrm/views.py index e0feaee75..ab42557c7 100644 --- a/bookwyrm/views.py +++ b/bookwyrm/views.py @@ -235,7 +235,6 @@ def login_page(request): # send user to the login page data = { 'title': 'Login', - 'site_settings': models.SiteSettings.get(), 'login_form': forms.LoginForm(), 'register_form': forms.RegisterForm(), } @@ -247,7 +246,6 @@ def about_page(request): ''' more information about the instance ''' data = { 'title': 'About', - 'site_settings': models.SiteSettings.get(), } return TemplateResponse(request, 'about.html', data) @@ -295,7 +293,6 @@ def invite_page(request, code): data = { 'title': 'Join', - 'site_settings': models.SiteSettings.get(), 'register_form': forms.RegisterForm(), 'invite': invite, } From 117d2435774ff9521f9028e472193e7253413106 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Fri, 11 Dec 2020 12:31:02 -0800 Subject: [PATCH 6/7] Expand site settings and add footer --- bookwyrm/context_processors.py | 8 ++++++ .../migrations/0016_auto_20201211_2026.py | 28 +++++++++++++++++++ bookwyrm/models/site.py | 3 ++ bookwyrm/templates/layout.html | 19 +++++++++++-- 4 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 bookwyrm/context_processors.py create mode 100644 bookwyrm/migrations/0016_auto_20201211_2026.py diff --git a/bookwyrm/context_processors.py b/bookwyrm/context_processors.py new file mode 100644 index 000000000..72839dcef --- /dev/null +++ b/bookwyrm/context_processors.py @@ -0,0 +1,8 @@ +''' customize the info available in context for rendering templates ''' +from bookwyrm import models + +def site_settings(request): + ''' include the custom info about the site ''' + return { + 'site': models.SiteSettings.objects.get() + } diff --git a/bookwyrm/migrations/0016_auto_20201211_2026.py b/bookwyrm/migrations/0016_auto_20201211_2026.py new file mode 100644 index 000000000..46b6140c3 --- /dev/null +++ b/bookwyrm/migrations/0016_auto_20201211_2026.py @@ -0,0 +1,28 @@ +# Generated by Django 3.0.7 on 2020-12-11 20:26 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('bookwyrm', '0015_auto_20201128_0349'), + ] + + operations = [ + migrations.AddField( + model_name='sitesettings', + name='admin_email', + field=models.EmailField(blank=True, max_length=255, null=True), + ), + migrations.AddField( + model_name='sitesettings', + name='support_link', + field=models.CharField(blank=True, max_length=255, null=True), + ), + migrations.AddField( + model_name='sitesettings', + name='support_title', + field=models.CharField(blank=True, max_length=100, null=True), + ), + ] diff --git a/bookwyrm/models/site.py b/bookwyrm/models/site.py index aa2e2a675..1577e3696 100644 --- a/bookwyrm/models/site.py +++ b/bookwyrm/models/site.py @@ -17,6 +17,9 @@ class SiteSettings(models.Model): code_of_conduct = models.TextField( default="Add a code of conduct here.") allow_registration = models.BooleanField(default=True) + support_link = models.CharField(max_length=255, null=True, blank=True) + support_title = models.CharField(max_length=100, null=True, blank=True) + admin_email = models.EmailField(max_length=255, null=True, blank=True) @classmethod def get(cls): diff --git a/bookwyrm/templates/layout.html b/bookwyrm/templates/layout.html index a363debda..b37c9cda1 100644 --- a/bookwyrm/templates/layout.html +++ b/bookwyrm/templates/layout.html @@ -124,8 +124,23 @@ From 733e0e19acc24e0fc2b61b1f92cfd99afb3076c5 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Fri, 11 Dec 2020 17:39:17 -0800 Subject: [PATCH 7/7] Don't show boost and original status in timeline Fixes #381 --- bookwyrm/views.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bookwyrm/views.py b/bookwyrm/views.py index ab42557c7..0fdfa1f90 100644 --- a/bookwyrm/views.py +++ b/bookwyrm/views.py @@ -131,7 +131,7 @@ def get_activity_feed(user, filter_level, model=models.Status): activities = model.objects activities = activities.filter( - deleted=False + deleted=False, ).order_by( '-published_date' ) @@ -160,6 +160,11 @@ def get_activity_feed(user, filter_level, model=models.Status): Q(user__in=following, privacy='followers') | Q(privacy='public') ) + try: + activities = activities.filter(~Q(boosters__in=activities)) + except ValueError: + pass + return activities