Merge branch 'main' into production

This commit is contained in:
Mouse Reeve 2021-08-07 15:18:15 -07:00
commit e363d1af11
4 changed files with 39 additions and 37 deletions

View file

@ -260,9 +260,6 @@ def add_status_on_create(sender, instance, created, *args, **kwargs):
stream.remove_object_from_related_stores(instance)
return
if not created:
return
for stream in streams.values():
stream.add_status(instance)
@ -358,25 +355,39 @@ def add_statuses_on_shelve(sender, instance, *args, **kwargs):
"""update books stream when user shelves a book"""
if not instance.user.local:
return
# check if the book is already on the user's shelves
if models.ShelfBook.objects.filter(
user=instance.user, book__in=instance.book.parent_work.editions.all()
).exists():
book = None
if hasattr(instance, "book"):
book = instance.book
elif instance.mention_books.exists():
book = instance.mention_books.first()
if not book:
return
BooksStream().add_book_statuses(instance.user, instance.book)
# check if the book is already on the user's shelves
editions = book.parent_work.editions.all()
if models.ShelfBook.objects.filter(user=instance.user, book__in=editions).exists():
return
BooksStream().add_book_statuses(instance.user, book)
@receiver(signals.post_delete, sender=models.ShelfBook)
# pylint: disable=unused-argument
def remove_statuses_on_shelve(sender, instance, *args, **kwargs):
def remove_statuses_on_unshelve(sender, instance, *args, **kwargs):
"""update books stream when user unshelves a book"""
if not instance.user.local:
return
book = None
if hasattr(instance, "book"):
book = instance.book
elif instance.mention_books.exists():
book = instance.mention_books.first()
if not book:
return
# check if the book is actually unshelved, not just moved
if models.ShelfBook.objects.filter(
user=instance.user, book__in=instance.book.parent_work.editions.all()
).exists():
editions = book.parent_work.editions.all()
if models.ShelfBook.objects.filter(user=instance.user, book__in=editions).exists():
return
BooksStream().remove_book_statuses(instance.user, instance.book)

View file

@ -47,7 +47,8 @@ class InboxCreate(TestCase):
}
models.SiteSettings.objects.create()
def test_create_status(self, _):
@patch("bookwyrm.activitystreams.ActivityStream.add_status")
def test_create_status(self, *_):
"""the "it justs works" mode"""
datafile = pathlib.Path(__file__).parent.joinpath(
"../../data/ap_quotation.json"

Binary file not shown.

View file

@ -685,30 +685,24 @@ msgid "Compose status"
msgstr "Rédiger un statut"
#: bookwyrm/templates/confirm_email/confirm_email.html:4
#, fuzzy
#| msgid "Confirm"
msgid "Confirm email"
msgstr "Confirmer"
msgstr "Confirmation de lemail"
#: bookwyrm/templates/confirm_email/confirm_email.html:7
#, fuzzy
#| msgid "Email address:"
msgid "Confirm your email address"
msgstr "Adresse email:"
msgstr "Veuillez confirmer votre adresse email"
#: bookwyrm/templates/confirm_email/confirm_email.html:13
msgid "A confirmation code has been sent to the email address you used to register your account."
msgstr ""
msgstr "Un code de confirmation a été envoyé à ladresse email rattachée à votre compte."
#: bookwyrm/templates/confirm_email/confirm_email.html:15
msgid "Sorry! We couldn't find that code."
msgstr ""
msgstr "Pardon! Nous ne reconnaissons pas ce code."
#: bookwyrm/templates/confirm_email/confirm_email.html:19
#, fuzzy
#| msgid "Confirm password:"
msgid "Confirmation code:"
msgstr "Confirmez le mot de passe:"
msgstr "Code de confirmation:"
#: bookwyrm/templates/confirm_email/confirm_email.html:25
#: bookwyrm/templates/discover/landing_layout.html:70
@ -718,11 +712,11 @@ msgstr "Valider"
#: bookwyrm/templates/confirm_email/confirm_email.html:32
msgid "Can't find your code?"
msgstr ""
msgstr "Vous ne trouvez pas votre code?"
#: bookwyrm/templates/confirm_email/resend_form.html:4
msgid "Resend confirmation link"
msgstr ""
msgstr "Envoyer le lien de confirmation de nouveau"
#: bookwyrm/templates/confirm_email/resend_form.html:11
#: bookwyrm/templates/discover/landing_layout.html:64
@ -733,10 +727,8 @@ msgid "Email address:"
msgstr "Adresse email:"
#: bookwyrm/templates/confirm_email/resend_form.html:17
#, fuzzy
#| msgid "Re-send invite"
msgid "Resend link"
msgstr "Envoyer linvitation de nouveau"
msgstr "Envoyer le lien de nouveau"
#: bookwyrm/templates/directory/community_filter.html:5
msgid "Community"
@ -886,17 +878,15 @@ msgstr "Votre compte"
#: bookwyrm/templates/email/confirm/text_content.html:4
#, python-format
msgid "One last step before you join %(site_name)s! Please confirm your email address by clicking the link below:"
msgstr ""
msgstr "Une dernière petite étape avant de rejoindre %(site_name)s! Veuillez confirmer votre adresse email en cliquant le lien cidessous:"
#: bookwyrm/templates/email/confirm/html_content.html:11
#, fuzzy
#| msgid "Confirm"
msgid "Confirm Email"
msgstr "Confirmer"
msgstr "Confirmation de lemail"
#: bookwyrm/templates/email/confirm/subject.html:2
msgid "Please confirm your email"
msgstr ""
msgstr "Veuillez confirmer votre adresse email"
#: bookwyrm/templates/email/html_layout.html:15
#: bookwyrm/templates/email/text_layout.html:2
@ -1564,7 +1554,7 @@ msgstr "Connexion"
#: bookwyrm/templates/login.html:16
msgid "Success! Email address confirmed."
msgstr ""
msgstr "Bravo! Ladresse email a été confirmée."
#: bookwyrm/templates/login.html:28 bookwyrm/templates/password_reset.html:17
#: bookwyrm/templates/snippets/register_form.html:22
@ -2397,11 +2387,11 @@ msgstr "Autoriser les demandes dinvitation"
#: bookwyrm/templates/settings/site.html:97
msgid "Require users to confirm email address"
msgstr ""
msgstr "Demander aux utilisateurs et utilisatrices de confirmer leur adresse email"
#: bookwyrm/templates/settings/site.html:99
msgid "(Recommended if registration is open)"
msgstr ""
msgstr "(Recommandé si les inscriptions sont ouvertes)"
#: bookwyrm/templates/settings/site.html:102
msgid "Registration closed text:"