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 toot_mode: bool = False
default_post_visibility: int = 0 # Post.Visibilities.public default_post_visibility: int = 0 # Post.Visibilities.public
visible_follows: bool = True visible_follows: bool = True
# wellness Options
visible_reaction_counts: bool = True

View file

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

View file

@ -1,9 +1,11 @@
{% if post.pk in interactions.boost %} {% if post.pk in interactions.boost %}
<a title="Unboost" class="active" hx-post="{{ post.urls.action_unboost }}" hx-swap="outerHTML"> <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> </a>
{% else %} {% else %}
<a title="Boost" hx-post="{{ post.urls.action_boost }}" hx-swap="outerHTML"> <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> </a>
{% endif %} {% endif %}

View file

@ -1,9 +1,11 @@
{% if post.pk in interactions.like %} {% if post.pk in interactions.like %}
<a title="Unlike" class="active" hx-post="{{ post.urls.action_unlike }}" hx-swap="outerHTML" role="menuitem"> <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> </a>
{% else %} {% else %}
<a title="Like" hx-post="{{ post.urls.action_like }}" hx-swap="outerHTML" role="menuitem"> <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> </a>
{% endif %} {% endif %}

View file

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

View file

@ -6,6 +6,9 @@
<a href="{% url "settings_interface" %}" {% if section == "interface" %}class="selected"{% endif %} title="Interface"> <a href="{% url "settings_interface" %}" {% if section == "interface" %}class="selected"{% endif %} title="Interface">
<i class="fa-solid fa-display"></i> Interface <i class="fa-solid fa-display"></i> Interface
</a> </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> <h3>Account</h3>
<a href="{% url "settings_security" %}" {% if section == "security" %}class="selected"{% endif %} title="Login &amp; Security"> <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 <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.profile import ProfilePage # noqa
from users.views.settings.security import SecurityPage # noqa from users.views.settings.security import SecurityPage # noqa
from users.views.settings.settings_page import SettingsPage # noqa from users.views.settings.settings_page import SettingsPage # noqa
from users.views.settings.wellness import WellnessPage # noqa
@method_decorator(identity_required, name="dispatch") @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"]}