From 5b3ea012ab0712cd6f02fe9cb07e75f2c4b5954a Mon Sep 17 00:00:00 2001 From: "M.Dent" Date: Tue, 12 Feb 2019 22:05:57 -0500 Subject: Fix: only first lock red with privacy_warning --- Zotlabs/Lib/ThreadItem.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Zotlabs/Lib/ThreadItem.php b/Zotlabs/Lib/ThreadItem.php index bdbfc4385..323f84acf 100644 --- a/Zotlabs/Lib/ThreadItem.php +++ b/Zotlabs/Lib/ThreadItem.php @@ -76,7 +76,7 @@ class ThreadItem { * _ false on failure */ - public function get_template_data($conv_responses, $thread_level=1) { + public function get_template_data($conv_responses, $thread_level=1, $conv_flags = []) { $result = array(); @@ -117,11 +117,17 @@ class ThreadItem { } if ($lock) { - if (count(get_terms_oftype($item['term'],TERM_FORUM))) { + if (($item['mid'] == $item['parent_mid']) && count(get_terms_oftype($item['term'],TERM_FORUM))) { $privacy_warning = true; } } + if ($privacy_warning) { + $conv_flags['privacy_warning'] = $privacy_warning; + } else { + $privacy_warning = (isset($conv_flags['privacy_warning'])) ? $conv_flags['privacy_warning'] : false; + } + if ($lock && $privacy_warning) { $lock = t('Privacy conflict. Discretion advised.'); } @@ -488,7 +494,7 @@ class ThreadItem { if(($this->get_display_mode() === 'normal') && ($nb_children > 0)) { foreach($children as $child) { - $result['children'][] = $child->get_template_data($conv_responses, $thread_level + 1); + $result['children'][] = $child->get_template_data($conv_responses, $thread_level + 1,$conv_flags); } // Collapse if(($nb_children > $visible_comments) || ($thread_level > 1)) { -- cgit v1.2.3 From c3e2b463e4604d5bb148ebbaa97b68ca33ce89e1 Mon Sep 17 00:00:00 2001 From: "M.Dent" Date: Wed, 13 Feb 2019 08:26:03 -0500 Subject: Only cascade privacy warning if thread parent has privacy concerns. --- Zotlabs/Lib/ThreadItem.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Zotlabs/Lib/ThreadItem.php b/Zotlabs/Lib/ThreadItem.php index 323f84acf..04265ee5a 100644 --- a/Zotlabs/Lib/ThreadItem.php +++ b/Zotlabs/Lib/ThreadItem.php @@ -119,14 +119,11 @@ class ThreadItem { if ($lock) { if (($item['mid'] == $item['parent_mid']) && count(get_terms_oftype($item['term'],TERM_FORUM))) { $privacy_warning = true; + $conv_flags['parent_privacy_warning'] = true; } } - if ($privacy_warning) { - $conv_flags['privacy_warning'] = $privacy_warning; - } else { - $privacy_warning = (isset($conv_flags['privacy_warning'])) ? $conv_flags['privacy_warning'] : false; - } + $privacy_warning = (isset($conv_flags['parent_privacy_warning'])) ? $conv_flags['parent_privacy_warning'] : $privacy_warning; if ($lock && $privacy_warning) { $lock = t('Privacy conflict. Discretion advised.'); -- cgit v1.2.3