forked from mirrors/bookwyrm
Apply review suggestions
This commit is contained in:
parent
7bdfacb688
commit
40e4591a24
6 changed files with 79 additions and 58 deletions
|
@ -9,6 +9,7 @@ from django.utils import timezone
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
from bookwyrm import models
|
from bookwyrm import models
|
||||||
|
from bookwyrm.models.user import FeedFilterChoices
|
||||||
|
|
||||||
|
|
||||||
class CustomForm(ModelForm):
|
class CustomForm(ModelForm):
|
||||||
|
@ -179,15 +180,9 @@ class FeedStatusTypesForm(CustomForm):
|
||||||
model = models.User
|
model = models.User
|
||||||
fields = ["feed_status_types"]
|
fields = ["feed_status_types"]
|
||||||
help_texts = {f: None for f in fields}
|
help_texts = {f: None for f in fields}
|
||||||
labels = {"feed_status_types": ""}
|
|
||||||
widgets = {
|
widgets = {
|
||||||
"feed_status_types": widgets.CheckboxSelectMultiple(
|
"feed_status_types": widgets.CheckboxSelectMultiple(
|
||||||
choices=[
|
choices=FeedFilterChoices,
|
||||||
("review", _("Reviews")),
|
|
||||||
("comment", _("Comments")),
|
|
||||||
("quotation", _("Quotations")),
|
|
||||||
("everything", _("Everything else")),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
# Generated by Django 3.2.5 on 2021-11-21 23:28
|
# Generated by Django 3.2.5 on 2021-11-24 10:15
|
||||||
|
|
||||||
|
import bookwyrm.models.user
|
||||||
import django.contrib.postgres.fields
|
import django.contrib.postgres.fields
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
@ -15,8 +16,16 @@ class Migration(migrations.Migration):
|
||||||
model_name="user",
|
model_name="user",
|
||||||
name="feed_status_types",
|
name="feed_status_types",
|
||||||
field=django.contrib.postgres.fields.ArrayField(
|
field=django.contrib.postgres.fields.ArrayField(
|
||||||
base_field=models.CharField(max_length=10),
|
base_field=models.CharField(
|
||||||
default=["review", "comment", "quotation", "everything"],
|
choices=[
|
||||||
|
("review", "Reviews"),
|
||||||
|
("comment", "Comments"),
|
||||||
|
("quotation", "Quotations"),
|
||||||
|
("everything", "Everything else"),
|
||||||
|
],
|
||||||
|
max_length=10,
|
||||||
|
),
|
||||||
|
default=bookwyrm.models.user.get_feed_filter_choices,
|
||||||
size=8,
|
size=8,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -9,6 +9,7 @@ from django.core.validators import MinValueValidator
|
||||||
from django.dispatch import receiver
|
from django.dispatch import receiver
|
||||||
from django.db import models, transaction
|
from django.db import models, transaction
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
|
from django.utils.translation import gettext_lazy as _
|
||||||
from model_utils import FieldTracker
|
from model_utils import FieldTracker
|
||||||
import pytz
|
import pytz
|
||||||
|
|
||||||
|
@ -27,6 +28,18 @@ from .federated_server import FederatedServer
|
||||||
from . import fields, Review
|
from . import fields, Review
|
||||||
|
|
||||||
|
|
||||||
|
FeedFilterChoices = [
|
||||||
|
("review", _("Reviews")),
|
||||||
|
("comment", _("Comments")),
|
||||||
|
("quotation", _("Quotations")),
|
||||||
|
("everything", _("Everything else")),
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def get_feed_filter_choices():
|
||||||
|
return [f[0] for f in FeedFilterChoices]
|
||||||
|
|
||||||
|
|
||||||
def site_link():
|
def site_link():
|
||||||
"""helper for generating links to the site"""
|
"""helper for generating links to the site"""
|
||||||
protocol = "https" if USE_HTTPS else "http"
|
protocol = "https" if USE_HTTPS else "http"
|
||||||
|
@ -130,9 +143,9 @@ class User(OrderedCollectionPageMixin, AbstractUser):
|
||||||
|
|
||||||
# feed options
|
# feed options
|
||||||
feed_status_types = ArrayField(
|
feed_status_types = ArrayField(
|
||||||
models.CharField(max_length=10, blank=False),
|
models.CharField(max_length=10, blank=False, choices=FeedFilterChoices),
|
||||||
size=8,
|
size=8,
|
||||||
default=list(["review", "comment", "quotation", "everything"]),
|
default=get_feed_filter_choices,
|
||||||
)
|
)
|
||||||
|
|
||||||
preferred_timezone = models.CharField(
|
preferred_timezone = models.CharField(
|
||||||
|
|
|
@ -42,7 +42,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="level-right">
|
<div class="level-right control">
|
||||||
<button class="button is-small is-primary is-outlined" type="submit">
|
<button class="button is-small is-primary is-outlined" type="submit">
|
||||||
{{ _("Save settings") }}
|
{{ _("Save settings") }}
|
||||||
</button>
|
</button>
|
||||||
|
@ -69,7 +69,8 @@
|
||||||
{# activity feed #}
|
{# activity feed #}
|
||||||
{% if not activities %}
|
{% if not activities %}
|
||||||
<div class="block content">
|
<div class="block content">
|
||||||
<p>{% trans "There aren't any activities right now! Try following a user to get started" %}{% if user.feed_status_types|length < 4 %}{% trans ", or enable more status types" %}{% endif %}</p>
|
<p>{% trans "There aren't any activities right now! Try following a user to get started" %}</p>
|
||||||
|
<p>{% if user.feed_status_types|length < 4 %}{% trans "Alternatively, you can try enabling more status types" %}{% endif %}</p>
|
||||||
|
|
||||||
{% if request.user.show_suggested_users and suggested_users %}
|
{% if request.user.show_suggested_users and suggested_users %}
|
||||||
{# suggested users for when things are very lonely #}
|
{# suggested users for when things are very lonely #}
|
||||||
|
|
|
@ -7,10 +7,10 @@ from django.shortcuts import get_object_or_404
|
||||||
from django.template.response import TemplateResponse
|
from django.template.response import TemplateResponse
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from django.utils.decorators import method_decorator
|
from django.utils.decorators import method_decorator
|
||||||
from django.utils.translation import gettext_lazy as _
|
|
||||||
from django.views import View
|
from django.views import View
|
||||||
|
|
||||||
from bookwyrm import activitystreams, forms, models
|
from bookwyrm import activitystreams, forms, models
|
||||||
|
from bookwyrm.models.user import FeedFilterChoices
|
||||||
from bookwyrm.activitypub import ActivitypubResponse
|
from bookwyrm.activitypub import ActivitypubResponse
|
||||||
from bookwyrm.settings import PAGE_LENGTH, STREAMS
|
from bookwyrm.settings import PAGE_LENGTH, STREAMS
|
||||||
from bookwyrm.suggested_users import suggested_users
|
from bookwyrm.suggested_users import suggested_users
|
||||||
|
@ -58,12 +58,7 @@ class Feed(View):
|
||||||
"tab": tab,
|
"tab": tab,
|
||||||
"streams": STREAMS,
|
"streams": STREAMS,
|
||||||
"goal_form": forms.GoalForm(),
|
"goal_form": forms.GoalForm(),
|
||||||
"feed_status_types_options": [
|
"feed_status_types_options": FeedFilterChoices,
|
||||||
("review", _("Reviews")),
|
|
||||||
("comment", _("Comments")),
|
|
||||||
("quotation", _("Quotations")),
|
|
||||||
("everything", _("Everything else")),
|
|
||||||
],
|
|
||||||
"settings_saved": settings_saved,
|
"settings_saved": settings_saved,
|
||||||
"path": f"/{tab['key']}",
|
"path": f"/{tab['key']}",
|
||||||
},
|
},
|
||||||
|
@ -260,12 +255,21 @@ def filter_stream_by_status_type(activities, allowed_types=None):
|
||||||
allowed_types = []
|
allowed_types = []
|
||||||
|
|
||||||
if "review" not in allowed_types:
|
if "review" not in allowed_types:
|
||||||
activities = activities.filter(Q(review__isnull=True))
|
activities = activities.filter(
|
||||||
|
Q(review__isnull=True) | Q(boost__boosted_status__review__isnull=True)
|
||||||
|
)
|
||||||
if "comment" not in allowed_types:
|
if "comment" not in allowed_types:
|
||||||
activities = activities.filter(Q(comment__isnull=True))
|
activities = activities.filter(
|
||||||
|
Q(comment__isnull=True) | Q(boost__boosted_status__comment__isnull=True)
|
||||||
|
)
|
||||||
if "quotation" not in allowed_types:
|
if "quotation" not in allowed_types:
|
||||||
activities = activities.filter(Q(quotation__isnull=True))
|
activities = activities.filter(
|
||||||
|
Q(quotation__isnull=True) | Q(boost__boosted_status__quotation__isnull=True)
|
||||||
|
)
|
||||||
if "everything" not in allowed_types:
|
if "everything" not in allowed_types:
|
||||||
activities = activities.filter(Q(generatednote__isnull=True))
|
activities = activities.filter(
|
||||||
|
Q(generatednote__isnull=True)
|
||||||
|
| Q(boost__boosted_status__generatednote__isnull=True)
|
||||||
|
)
|
||||||
|
|
||||||
return activities
|
return activities
|
||||||
|
|
|
@ -8,7 +8,7 @@ msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: 0.0.1\n"
|
"Project-Id-Version: 0.0.1\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2021-11-22 18:23+0000\n"
|
"POT-Creation-Date: 2021-11-24 10:57+0000\n"
|
||||||
"PO-Revision-Date: 2021-02-28 17:19-0800\n"
|
"PO-Revision-Date: 2021-02-28 17:19-0800\n"
|
||||||
"Last-Translator: Mouse Reeve <mousereeve@riseup.net>\n"
|
"Last-Translator: Mouse Reeve <mousereeve@riseup.net>\n"
|
||||||
"Language-Team: English <LL@li.org>\n"
|
"Language-Team: English <LL@li.org>\n"
|
||||||
|
@ -18,75 +18,58 @@ msgstr ""
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||||
|
|
||||||
#: bookwyrm/forms.py:186 bookwyrm/templates/book/book.html:218
|
#: bookwyrm/forms.py:262
|
||||||
#: bookwyrm/views/feed.py:62
|
|
||||||
msgid "Reviews"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: bookwyrm/forms.py:187 bookwyrm/views/feed.py:63
|
|
||||||
msgid "Comments"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: bookwyrm/forms.py:188 bookwyrm/views/feed.py:64
|
|
||||||
msgid "Quotations"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: bookwyrm/forms.py:189 bookwyrm/views/feed.py:65
|
|
||||||
msgid "Everything else"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: bookwyrm/forms.py:266
|
|
||||||
msgid "A user with this email already exists."
|
msgid "A user with this email already exists."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: bookwyrm/forms.py:280
|
#: bookwyrm/forms.py:276
|
||||||
msgid "One Day"
|
msgid "One Day"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: bookwyrm/forms.py:281
|
#: bookwyrm/forms.py:277
|
||||||
msgid "One Week"
|
msgid "One Week"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: bookwyrm/forms.py:282
|
#: bookwyrm/forms.py:278
|
||||||
msgid "One Month"
|
msgid "One Month"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: bookwyrm/forms.py:283
|
#: bookwyrm/forms.py:279
|
||||||
msgid "Does Not Expire"
|
msgid "Does Not Expire"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: bookwyrm/forms.py:287
|
#: bookwyrm/forms.py:283
|
||||||
#, python-brace-format
|
#, python-brace-format
|
||||||
msgid "{i} uses"
|
msgid "{i} uses"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: bookwyrm/forms.py:288
|
#: bookwyrm/forms.py:284
|
||||||
msgid "Unlimited"
|
msgid "Unlimited"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: bookwyrm/forms.py:356
|
#: bookwyrm/forms.py:352
|
||||||
msgid "List Order"
|
msgid "List Order"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: bookwyrm/forms.py:357
|
#: bookwyrm/forms.py:353
|
||||||
msgid "Book Title"
|
msgid "Book Title"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: bookwyrm/forms.py:358 bookwyrm/templates/shelf/shelf.html:149
|
#: bookwyrm/forms.py:354 bookwyrm/templates/shelf/shelf.html:149
|
||||||
#: bookwyrm/templates/shelf/shelf.html:181
|
#: bookwyrm/templates/shelf/shelf.html:181
|
||||||
#: bookwyrm/templates/snippets/create_status/review.html:33
|
#: bookwyrm/templates/snippets/create_status/review.html:33
|
||||||
msgid "Rating"
|
msgid "Rating"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: bookwyrm/forms.py:360 bookwyrm/templates/lists/list.html:110
|
#: bookwyrm/forms.py:356 bookwyrm/templates/lists/list.html:110
|
||||||
msgid "Sort By"
|
msgid "Sort By"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: bookwyrm/forms.py:364
|
#: bookwyrm/forms.py:360
|
||||||
msgid "Ascending"
|
msgid "Ascending"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: bookwyrm/forms.py:365
|
#: bookwyrm/forms.py:361
|
||||||
msgid "Descending"
|
msgid "Descending"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -170,6 +153,22 @@ msgstr ""
|
||||||
msgid "A user with that username already exists."
|
msgid "A user with that username already exists."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: bookwyrm/models/user.py:32 bookwyrm/templates/book/book.html:218
|
||||||
|
msgid "Reviews"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: bookwyrm/models/user.py:33
|
||||||
|
msgid "Comments"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: bookwyrm/models/user.py:34
|
||||||
|
msgid "Quotations"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: bookwyrm/models/user.py:35
|
||||||
|
msgid "Everything else"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: bookwyrm/settings.py:118
|
#: bookwyrm/settings.py:118
|
||||||
msgid "Home Timeline"
|
msgid "Home Timeline"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -1108,8 +1107,8 @@ msgstr ""
|
||||||
msgid "There aren't any activities right now! Try following a user to get started"
|
msgid "There aren't any activities right now! Try following a user to get started"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: bookwyrm/templates/feed/feed.html:72
|
#: bookwyrm/templates/feed/feed.html:73
|
||||||
msgid ", or enable more status types"
|
msgid "Alternatively, you can try enabling more status types"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: bookwyrm/templates/feed/goal_card.html:6
|
#: bookwyrm/templates/feed/goal_card.html:6
|
||||||
|
|
Loading…
Reference in a new issue