parent
c9f7a06fe5
commit
d32a686eb1
|
@ -9,7 +9,7 @@ from django.contrib.postgres.indexes import GinIndex
|
|||
from django.db import models, transaction
|
||||
from django.template import loader
|
||||
from django.template.defaultfilters import linebreaks_filter
|
||||
from django.utils import timezone
|
||||
from django.utils import text, timezone
|
||||
|
||||
from activities.models.emoji import Emoji
|
||||
from activities.models.fan_out import FanOut
|
||||
|
@ -388,6 +388,14 @@ class Post(StatorModel):
|
|||
"""
|
||||
return self.safe_content(local=False)
|
||||
|
||||
def summary_class(self) -> str:
|
||||
"""
|
||||
Returns a CSS class name to identify this summary value
|
||||
"""
|
||||
if not self.summary:
|
||||
return ""
|
||||
return "summary-" + text.slugify(self.summary, allow_unicode=True)
|
||||
|
||||
### Async helpers ###
|
||||
|
||||
async def afetch_full(self) -> "Post":
|
||||
|
|
|
@ -120,6 +120,7 @@ class Compose(FormView):
|
|||
initial["visibility"] = Post.Visibilities.unlisted
|
||||
else:
|
||||
initial["visibility"] = self.reply_to.visibility
|
||||
initial["content_warning"] = self.reply_to.summary
|
||||
# Build a set of mentions for the content to start as
|
||||
mentioned = {self.reply_to.author}
|
||||
mentioned.update(self.reply_to.mentions.all())
|
||||
|
|
|
@ -246,5 +246,6 @@ class Config(models.Model):
|
|||
|
||||
# wellness Options
|
||||
visible_reaction_counts: bool = True
|
||||
expand_linked_cws: bool = True
|
||||
|
||||
custom_css: str | None
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{% load static %}
|
||||
{% load activity_tags %}
|
||||
<div class="post {% if reply %}reply{% endif %}" data-takahe-id="{{ post.id }}" role="article" tabindex="0">
|
||||
<div class="post {% if reply %}reply{% endif %} {{ post.summary_class }}" data-takahe-id="{{ post.id }}" role="article" tabindex="0">
|
||||
|
||||
<a href="{{ post.author.urls.view }}" tabindex="-1">
|
||||
<img src="{{ post.author.local_icon_url.relative }}" class="icon" loading="lazy">
|
||||
|
@ -30,12 +30,16 @@
|
|||
</a>
|
||||
|
||||
{% if post.summary %}
|
||||
<div class="summary" _="on click toggle .enabled then toggle .hidden on the next .content then halt">
|
||||
{% if config_identity.expand_linked_cws %}
|
||||
<div class="summary" _="on click toggle .enabled on <.{{ post.summary_class }} .summary/> then toggle .hidden on <.{{ post.summary_class }} .content/> then halt">
|
||||
{% else %}
|
||||
<div class="summary" _="on click toggle .enabled then toggle .hidden on the next .content then halt">
|
||||
{% endif %}
|
||||
{{ post.summary }}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="content {% if post.summary %}hidden{% endif %}">
|
||||
<div class="content {% if post.summary %}hidden {% endif %}">
|
||||
{{ post.safe_content_local }}
|
||||
|
||||
{% if post.attachments.exists %}
|
||||
|
|
|
@ -25,10 +25,14 @@ class InterfacePage(SettingsPage):
|
|||
"help_text": "Theme the website however you'd like, just for you. You should probably not use this unless you know what you're doing.",
|
||||
"display": "textarea",
|
||||
},
|
||||
"expand_linked_cws": {
|
||||
"title": "Expand linked Content Warnings",
|
||||
"help_text": "Expands all CWs of the same type at once, rather than one at a time.",
|
||||
},
|
||||
}
|
||||
|
||||
layout = {
|
||||
"Posting": ["toot_mode", "default_post_visibility"],
|
||||
"Wellness": ["visible_reaction_counts"],
|
||||
"Wellness": ["visible_reaction_counts", "expand_linked_cws"],
|
||||
"Appearance": ["custom_css"],
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue