Fixes #239 - Add option to hide Boost and Like counts (#247)

This commit is contained in:
Michael Manfre 2022-12-24 00:16:26 -05:00 committed by GitHub
parent 9fb18ac841
commit aca77314d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 40 additions and 4 deletions

View File

@ -243,3 +243,6 @@ class Config(models.Model):
toot_mode: bool = False
default_post_visibility: int = 0 # Post.Visibilities.public
visible_follows: bool = True
# wellness Options
visible_reaction_counts: bool = True

View File

@ -46,6 +46,11 @@ urlpatterns = [
settings.InterfacePage.as_view(),
name="settings_interface",
),
path(
"settings/user/",
settings.WellnessPage.as_view(),
name="settings_wellness",
),
path(
"admin/",
admin.AdminRoot.as_view(),

View File

@ -1,9 +1,11 @@
{% if post.pk in interactions.boost %}
<a title="Unboost" class="active" hx-post="{{ post.urls.action_unboost }}" hx-swap="outerHTML">
<i class="fa-solid fa-retweet"></i> {% if event.boost_count is not None %}{{ event.boost_count }}{% else %}{{ post.boost_count }}{% endif %}
<i class="fa-solid fa-retweet"></i>
<span class="like-count">{% if event.boost_count is not None %}{{ event.boost_count }}{% else %}{{ post.boost_count }}{% endif %}</span>
</a>
{% else %}
<a title="Boost" hx-post="{{ post.urls.action_boost }}" hx-swap="outerHTML">
<i class="fa-solid fa-retweet"></i> {% if event.boost_count is not None %}{{ event.boost_count }}{% else %}{{ post.boost_count }}{% endif %}
<i class="fa-solid fa-retweet"></i>
<span class="like-count">{% if event.boost_count is not None %}{{ event.boost_count }}{% else %}{{ post.boost_count }}{% endif %}</span>
</a>
{% endif %}

View File

@ -1,9 +1,11 @@
{% if post.pk in interactions.like %}
<a title="Unlike" class="active" hx-post="{{ post.urls.action_unlike }}" hx-swap="outerHTML" role="menuitem">
<i class="fa-solid fa-star"></i> {% if event.like_count is not None %}{{ event.like_count }}{% else %}{{ post.like_count }}{% endif %}
<i class="fa-solid fa-star"></i>
<span class="like-count">{% if event.like_count is not None %}{{ event.like_count }}{% else %}{{ post.like_count }}{% endif %}</span>
</a>
{% else %}
<a title="Like" hx-post="{{ post.urls.action_like }}" hx-swap="outerHTML" role="menuitem">
<i class="fa-solid fa-star"></i> {% if event.like_count is not None %}{{ event.like_count }}{% else %}{{ post.like_count }}{% endif %}
<i class="fa-solid fa-star"></i>
<span class="like-count">{% if event.like_count is not None %}{{ event.like_count }}{% else %}{{ post.like_count }}{% endif %}</span>
</a>
{% endif %}

View File

@ -16,6 +16,11 @@
body {
--color-highlight: {{ config.highlight_color }};
}
{% if not config_system.visible_reaction_counts %}
.like-count {
display: none;
}
{% endif %}
</style>
{% block extra_head %}{% endblock %}
</head>

View File

@ -6,6 +6,9 @@
<a href="{% url "settings_interface" %}" {% if section == "interface" %}class="selected"{% endif %} title="Interface">
<i class="fa-solid fa-display"></i> Interface
</a>
<a href="{% url "settings_wellness" %}" {% if section == "wellness" %}class="selected"{% endif %} title="Wellness">
<i class="fa-solid fa-staff-snake"></i> Wellness
</a>
<h3>Account</h3>
<a href="{% url "settings_security" %}" {% if section == "security" %}class="selected"{% endif %} title="Login &amp; Security">
<i class="fa-solid fa-key"></i> Login &amp; Security

View File

@ -6,6 +6,7 @@ from users.views.settings.interface import InterfacePage # noqa
from users.views.settings.profile import ProfilePage # noqa
from users.views.settings.security import SecurityPage # noqa
from users.views.settings.settings_page import SettingsPage # noqa
from users.views.settings.wellness import WellnessPage # noqa
@method_decorator(identity_required, name="dispatch")

View File

@ -0,0 +1,15 @@
from users.views.settings.settings_page import SettingsPage
class WellnessPage(SettingsPage):
section = "wellness"
options = {
"visible_reaction_counts": {
"title": "Show Boost and Like Counts",
"help_text": "Disable to hide the number of Likes and Boosts on a 'Post'",
},
}
layout = {"Wellness": ["visible_reaction_counts"]}