Merge branch 'main' into production

This commit is contained in:
Mouse Reeve 2021-04-15 16:41:50 -07:00
commit 9ad369203f
5 changed files with 175 additions and 152 deletions

View file

@ -359,6 +359,10 @@ class CollectionItemMixin(ActivitypubMixin):
activity_serializer = activitypub.CollectionItem activity_serializer = activitypub.CollectionItem
def broadcast(self, activity, sender, software="bookwyrm"):
""" only send book collection updates to other bookwyrm instances """
super().broadcast(activity, sender, software=software)
@property @property
def privacy(self): def privacy(self):
""" inherit the privacy of the list, or direct if pending """ """ inherit the privacy of the list, or direct if pending """
@ -371,6 +375,9 @@ class CollectionItemMixin(ActivitypubMixin):
def recipients(self): def recipients(self):
""" the owner of the list is a direct recipient """ """ the owner of the list is a direct recipient """
collection_field = getattr(self, self.collection_field) collection_field = getattr(self, self.collection_field)
if collection_field.user.local:
# don't broadcast to yourself
return []
return [collection_field.user] return [collection_field.user]
def save(self, *args, broadcast=True, **kwargs): def save(self, *args, broadcast=True, **kwargs):

View file

@ -3,6 +3,12 @@ html {
scroll-padding-top: 20%; scroll-padding-top: 20%;
} }
body {
min-height: 100vh;
display: flex;
flex-direction: column;
}
.image { .image {
overflow: hidden; overflow: hidden;
} }

View file

@ -22,7 +22,8 @@
<meta name="twitter:image:alt" content="BookWyrm Logo"> <meta name="twitter:image:alt" content="BookWyrm Logo">
</head> </head>
<body> <body>
<nav class="navbar container" aria-label="main navigation"> <nav class="navbar" aria-label="main navigation">
<div class="container">
<div class="navbar-brand"> <div class="navbar-brand">
<a class="navbar-item" href="/"> <a class="navbar-item" href="/">
<img class="image logo" src="{% if site.logo_small %}/images/{{ site.logo_small }}{% else %}/static/images/logo-small.png{% endif %}" alt="Home page"> <img class="image logo" src="{% if site.logo_small %}/images/{{ site.logo_small }}{% else %}/static/images/logo-small.png{% endif %}" alt="Home page">
@ -175,13 +176,16 @@
{% endif %} {% endif %}
</div> </div>
</div> </div>
</div>
</nav> </nav>
<div class="section container"> <div class="section is-flex-grow-1">
<div class="container">
{% block content %} {% block content %}
{% endblock %} {% endblock %}
</div> </div>
</div>
<footer class="footer"> <footer class="footer">
<div class="container"> <div class="container">

View file

@ -55,7 +55,7 @@ class List(TestCase):
self.assertTrue(item.approved) self.assertTrue(item.approved)
self.assertEqual(item.privacy, "unlisted") self.assertEqual(item.privacy, "unlisted")
self.assertEqual(item.recipients, [self.local_user]) self.assertEqual(item.recipients, [])
def test_list_item_pending(self, _): def test_list_item_pending(self, _):
""" a list entry """ """ a list entry """
@ -71,4 +71,4 @@ class List(TestCase):
self.assertFalse(item.approved) self.assertFalse(item.approved)
self.assertEqual(item.book_list.privacy, "public") self.assertEqual(item.book_list.privacy, "public")
self.assertEqual(item.privacy, "direct") self.assertEqual(item.privacy, "direct")
self.assertEqual(item.recipients, [self.local_user]) self.assertEqual(item.recipients, [])

View file

@ -53,7 +53,7 @@ services:
- 8000:8000 - 8000:8000
redis_activity: redis_activity:
image: redis image: redis
command: redis-server --requirepass ${REDIS_ACTIVITY_PASSWORD} command: redis-server --requirepass ${REDIS_ACTIVITY_PASSWORD} --appendonly yes
volumes: volumes:
- ./redis.conf:/etc/redis/redis.conf - ./redis.conf:/etc/redis/redis.conf
env_file: .env env_file: .env
@ -62,9 +62,11 @@ services:
networks: networks:
- main - main
restart: on-failure restart: on-failure
volumes:
- redis_activity_data:/data
redis_broker: redis_broker:
image: redis image: redis
command: redis-server --requirepass ${REDIS_BROKER_PASSWORD} command: redis-server --requirepass ${REDIS_BROKER_PASSWORD} --appendonly yes
volumes: volumes:
- ./redis.conf:/etc/redis/redis.conf - ./redis.conf:/etc/redis/redis.conf
env_file: .env env_file: .env
@ -73,6 +75,8 @@ services:
networks: networks:
- main - main
restart: on-failure restart: on-failure
volumes:
- redis_broker_data:/data
celery_worker: celery_worker:
env_file: .env env_file: .env
build: . build: .
@ -106,5 +110,7 @@ volumes:
backups: backups:
static_volume: static_volume:
media_volume: media_volume:
redis_broker_data:
redis_activity_data:
networks: networks:
main: main: