From 41db5f09128f7ce0098da0cbb3f7715ac7534ed4 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Wed, 4 Apr 2018 22:50:39 -0400 Subject: [PATCH] Display content warning as title if collapsing is deactivated --- include/conversation.php | 10 ++++++++-- src/Object/Post.php | 8 +++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/include/conversation.php b/include/conversation.php index c473d011be..9647fac35f 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -756,7 +756,13 @@ function conversation(App $a, $items, $mode, $update, $preview = false, $order = list($categories, $folders) = get_cats_and_terms($item); $profile_name_e = $profile_name; - $item['title_e'] = $item['title']; + + if (!empty($item['content-warning']) && PConfig::get(local_user(), 'social', 'disable_cw', false)) { + $title_e = ucfirst($item['content-warning']); + } else { + $title_e = $item['title']; + } + $body_e = $body; $tags_e = $tags; $hashtags_e = $hashtags; @@ -781,7 +787,7 @@ function conversation(App $a, $items, $mode, $update, $preview = false, $order = 'sparkle' => $sparkle, 'lock' => $lock, 'thumb' => System::removedBaseUrl(proxy_url($item['author-thumb'], false, PROXY_SIZE_THUMB)), - 'title' => $item['title_e'], + 'title' => $title_e, 'body' => $body_e, 'tags' => $tags_e, 'hashtags' => $hashtags_e, diff --git a/src/Object/Post.php b/src/Object/Post.php index ecc6956be7..f47efbecd2 100644 --- a/src/Object/Post.php +++ b/src/Object/Post.php @@ -316,7 +316,13 @@ class Post extends BaseObject $body_e = $body; $text_e = strip_tags($body); $name_e = $profile_name; - $title_e = $item['title']; + + if (!empty($item['content-warning']) && PConfig::get(local_user(), 'social', 'disable_cw', false)) { + $title_e = ucfirst($item['content-warning']); + } else { + $title_e = $item['title']; + } + $location_e = $location; $owner_name_e = $this->getOwnerName(); -- 2.39.5