Node.js based forum software built for the modern web
feat(activitypub): hide content and thumbs behind CW in templates
Julian Lam0b3433ebd2f6
diff --git a/src/views/emails/partials/digest-topic.tpl b/src/views/emails/partials/digest-topic.tplindex 8024c56c77..6187b0cfa0 100644--- a/src/views/emails/partials/digest-topic.tpl+++ b/src/views/emails/partials/digest-topic.tpl@@ -9,6 +9,9 @@</tr><tr><td colspan="2" style="padding: 8px 16px; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol; line-height: 16px; color: #333333;">+ {{{ if ./teaser.contentWarning }}}+ <p style="margin: 0; padding: 6px 0px; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol; font-size: 13px; line-height: 26px; color: #999999; font-style: italic;">⚠️ {./teaser.contentWarning}</p>+ {{{ end }}}<p style="margin: 0; padding: 6px 0px; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol; font-size: 13px; line-height: 26px; color: #666666;">{./teaser.content}</p><p style="margin: 0; padding: 6px 0px; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol; line-height: 16px;"><a style="text-decoration:none !important; text-decoration:none; text-transform: capitalize; color: #666666; line-height: 16px;" href="{url}/topic/{./slug}">diff --git a/src/views/partials/feed/item.tpl b/src/views/partials/feed/item.tplindex e8e0a693cb..5eaf94c7db 100644--- a/src/views/partials/feed/item.tpl+++ b/src/views/partials/feed/item.tpl@@ -1,5 +1,5 @@<li component="category/topic" data-tid="{./topic.tid}" class="shadow-sm mb-3 rounded-2 border posts-list-item {{{ if ./deleted }}} deleted{{{ else }}}{{{ if ./topic.deleted }}} deleted{{{ end }}}{{{ end }}}{{{ if ./topic.scheduled }}} scheduled{{{ end }}}" data-pid="{./pid}" data-uid="{./uid}" data-index="{./index}">- {{{ if (showThumbs && ./topic.thumbs.length)}}}+ {{{ if (!./contentWarning && showThumbs && ./topic.thumbs.length)}}}<div class="p-1 position-relative"><div class="overflow-hidden rounded-1" style="max-height: 300px;"><a href="{config.relative_path}/topic/{./topic.slug}">@@ -56,7 +56,14 @@<div component="post/content" class="content text-sm text-break position-relative line-clamp-6"><a href="{config.relative_path}/post/{encodeURIComponent(./pid)}" class="stretched-link"></a>+ {{{ if ./contentWarning }}}+ <details class="content-warning">+ <summary>{./contentWarning}</summary>{{{ if ./txContent}}}{{tx(./content)}}{{{ else }}}{{./content}}{{{ end }}}+ </details>+ {{{ else }}}+ {{{ if ./txContent}}}{{tx(./content)}}{{{ else }}}{{./content}}{{{ end }}}+ {{{ end }}}</div><button component="show/more" class="btn btn-link btn-sm fw-semibold hidden ff-secondary text-secondary ms-auto me-auto">{{tx("world:see-more")}}</button><hr class="my-2"/>diff --git a/src/views/partials/topic/post-parent.tpl b/src/views/partials/topic/post-parent.tplindex 92eead1bad..a12f577513 100644--- a/src/views/partials/topic/post-parent.tpl+++ b/src/views/partials/topic/post-parent.tpl@@ -7,5 +7,14 @@<a href="{config.relative_path}/post/{encodeURIComponent(./parent.pid)}" class="text-muted timeago text-nowrap hidden" title="{./parent.timestampISO}"></a></div>- <div component="post/parent/content" class="text-muted line-clamp-1 text-break w-100">{{{ if ./parent.txContent }}}{{tx(./parent.content)}}{{{ else }}}{{./parent.content}}{{{ end }}}</div>+ <div component="post/parent/content" class="text-muted line-clamp-1 text-break w-100">+ {{{ if ./parent.contentWarning }}}+ <details class="content-warning">+ <summary>{./parent.contentWarning}</summary>+ {{{ if ./parent.txContent }}}{{tx(./parent.content)}}{{{ else }}}{{./parent.content}}{{{ end }}}+ </details>+ {{{ else }}}+ {{{ if ./parent.txContent }}}{{tx(./parent.content)}}{{{ else }}}{{./parent.content}}{{{ end }}}+ {{{ end }}}+ </div></div>diff --git a/src/views/partials/topic/post-preview.tpl b/src/views/partials/topic/post-preview.tplindex ab95a74106..2ada2efbc1 100644--- a/src/views/partials/topic/post-preview.tpl+++ b/src/views/partials/topic/post-preview.tpl@@ -9,6 +9,15 @@<a href="{config.relative_path}/post/{post.pid}" class="timeago text-xs text-secondary lh-1" style="vertical-align: middle;" title="{post.timestampISO}"></a></div></div>- <div class="content ghost-scrollbar" style="max-height: 300px; overflow-y:auto;">{{post.content}}</div>+ <div class="content ghost-scrollbar" style="max-height: 300px; overflow-y:auto;">+ {{{ if post.contentWarning }}}+ <details class="content-warning">+ <summary>{post.contentWarning}</summary>+ {{post.content}}+ </details>+ {{{ else }}}+ {{post.content}}+ {{{ end }}}+ </div></div></div>