From d83c43d9c9bc5cd12c9c8b3df6d249fad5b753a8 Mon Sep 17 00:00:00 2001
From: Jonas Kohl
Date: Sat, 12 Oct 2024 20:10:25 +0200
Subject: Remove spoilers from search results and profiles

---
 src/application/views/view_search_results.php | 2 +-
 src/application/views/view_user.php           | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

(limited to 'src/application/views')

diff --git a/src/application/views/view_search_results.php b/src/application/views/view_search_results.php
index 93e36f7..660284d 100644
--- a/src/application/views/view_search_results.php
+++ b/src/application/views/view_search_results.php
@@ -16,7 +16,7 @@ use mystic\forum\utils\StringUtils;
                 <?php if ($hasAttachments): ?>
                     <span class="badge"><span class="fa fa-paperclip"></span></span>
                 <?php endif; ?>
-                <?= htmlentities(html_entity_decode(StringUtils::truncate(strip_tags(renderPost($post->content)), 100))) ?><br>
+                <?= renderPostSummary($post->content) ?><br>
                 <span class="text-muted"><?= __("posted by %author% on %post_date% in %topic%", [
                     "author" => '<em>' . htmlentities($users[$post->authorId]?->displayName ?? __("unknown")) . '</em>',
                     "post_date" => '<span class="_time">' . htmlentities($post->postDate->format("c")) . '</span>',
diff --git a/src/application/views/view_user.php b/src/application/views/view_user.php
index c95b557..e7c9753 100644
--- a/src/application/views/view_user.php
+++ b/src/application/views/view_user.php
@@ -56,7 +56,7 @@ $emailPending = $isOwnProfile && $user->pendingEmail !== null;
                         <?php if ($hasAttachments): ?>
                             <span class="badge"><span class="fa fa-paperclip"></span></span>
                         <?php endif; ?>
-                        <?= htmlentities(html_entity_decode(StringUtils::truncate(strip_tags(renderPost($post->content)), 100))) ?><br>
+                        <?= renderPostSummary($post->content) ?><br>
                         <span class="text-muted"><?= __("posted on %post_date% in %topic%", [
                             "post_date" => '<span class="_time">' . htmlentities($post->postDate->format("c")) . '</span>',
                             "topic" => '<em>' .
-- 
cgit v1.2.3