From 114486309013d6618b49b8a1e174dc8e7b69913a Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 18 Sep 2019 05:20:33 +0000 Subject: [PATCH 1/3] Changed "hidewall" behaviour --- mod/community.php | 4 ++-- mod/item.php | 4 ---- src/Model/Contact.php | 7 ++++--- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/mod/community.php b/mod/community.php index 5ffb00729..61cca730d 100644 --- a/mod/community.php +++ b/mod/community.php @@ -237,9 +237,9 @@ function community_getitems($start, $itemspage, $content, $accounttype) return DBA::toArray($r); } elseif ($content == 'global') { if (!is_null($accounttype)) { - $condition = ["`uid` = ? AND `owner`.`contact-type` = ?", 0, $accounttype]; + $condition = ["`uid` = ? AND NOT `author`.`unsearchable` AND NOT `owner`.`unsearchable` AND `owner`.`contact-type` = ?", 0, $accounttype]; } else { - $condition = ['uid' => 0]; + $condition = ["`uid` = ? AND NOT `author`.`unsearchable` AND NOT `owner`.`unsearchable`", 0]; } $r = Item::selectThreadForUser(0, ['uri'], $condition, ['order' => ['commented' => true], 'limit' => [$start, $itemspage]]); diff --git a/mod/item.php b/mod/item.php index 51bbc76e7..8bc394bcb 100644 --- a/mod/item.php +++ b/mod/item.php @@ -284,10 +284,6 @@ function item_post(App $a) { $private = ((strlen($str_group_allow) || strlen($str_contact_allow) || strlen($str_group_deny) || strlen($str_contact_deny)) ? 1 : 0); - if ($user['hidewall']) { - $private = 2; - } - // If this is a comment, set the permissions from the parent. if ($toplevel_item) { diff --git a/src/Model/Contact.php b/src/Model/Contact.php index 542ae95bc..a5c14754f 100644 --- a/src/Model/Contact.php +++ b/src/Model/Contact.php @@ -668,21 +668,21 @@ class Contact extends BaseObject public static function updateSelfFromUserID($uid, $update_avatar = false) { $fields = ['id', 'name', 'nick', 'location', 'about', 'keywords', 'gender', 'avatar', - 'xmpp', 'contact-type', 'forum', 'prv', 'avatar-date', 'url', 'nurl', + 'xmpp', 'contact-type', 'forum', 'prv', 'avatar-date', 'url', 'nurl', 'unsearchable', 'photo', 'thumb', 'micro', 'addr', 'request', 'notify', 'poll', 'confirm', 'poco']; $self = DBA::selectFirst('contact', $fields, ['uid' => $uid, 'self' => true]); if (!DBA::isResult($self)) { return; } - $fields = ['nickname', 'page-flags', 'account-type']; + $fields = ['nickname', 'page-flags', 'account-type', 'hidewall']; $user = DBA::selectFirst('user', $fields, ['uid' => $uid]); if (!DBA::isResult($user)) { return; } $fields = ['name', 'photo', 'thumb', 'about', 'address', 'locality', 'region', - 'country-name', 'gender', 'pub_keywords', 'xmpp']; + 'country-name', 'gender', 'pub_keywords', 'xmpp', 'net-publish']; $profile = DBA::selectFirst('profile', $fields, ['uid' => $uid, 'is-default' => true]); if (!DBA::isResult($profile)) { return; @@ -727,6 +727,7 @@ class Contact extends BaseObject $fields['avatar'] = System::baseUrl() . '/photo/profile/' .$uid . '.' . $file_suffix; $fields['forum'] = $user['page-flags'] == User::PAGE_FLAGS_COMMUNITY; $fields['prv'] = $user['page-flags'] == User::PAGE_FLAGS_PRVGROUP; + $fields['unsearchable'] = $user['hidewall'] || $profile['net-publish']; // it seems as if ported accounts can have wrong values, so we make sure that now everything is fine. $fields['url'] = System::baseUrl() . '/profile/' . $user['nickname']; From 9e7467f8f9a98bbc94d565328a15da1beb970d54 Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 18 Sep 2019 05:56:06 +0000 Subject: [PATCH 2/3] Added to-do --- mod/community.php | 1 + 1 file changed, 1 insertion(+) diff --git a/mod/community.php b/mod/community.php index 61cca730d..3cafced54 100644 --- a/mod/community.php +++ b/mod/community.php @@ -227,6 +227,7 @@ function community_getitems($start, $itemspage, $content, $accounttype) $values = [$start, $itemspage]; } + /// @todo Use "unsearchable" here as well (instead of "hidewall") $r = DBA::p("SELECT `item`.`uri`, `author`.`url` AS `author-link` FROM `thread` STRAIGHT_JOIN `user` ON `user`.`uid` = `thread`.`uid` AND NOT `user`.`hidewall` STRAIGHT_JOIN `item` ON `item`.`id` = `thread`.`iid` From 358cbe812a8459150a0c7d1cc2aecbcb75271391 Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 18 Sep 2019 16:37:13 +0000 Subject: [PATCH 3/3] Correction: Must be inverted --- src/Model/Contact.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Model/Contact.php b/src/Model/Contact.php index a5c14754f..23d4ec62d 100644 --- a/src/Model/Contact.php +++ b/src/Model/Contact.php @@ -727,7 +727,7 @@ class Contact extends BaseObject $fields['avatar'] = System::baseUrl() . '/photo/profile/' .$uid . '.' . $file_suffix; $fields['forum'] = $user['page-flags'] == User::PAGE_FLAGS_COMMUNITY; $fields['prv'] = $user['page-flags'] == User::PAGE_FLAGS_PRVGROUP; - $fields['unsearchable'] = $user['hidewall'] || $profile['net-publish']; + $fields['unsearchable'] = $user['hidewall'] || !$profile['net-publish']; // it seems as if ported accounts can have wrong values, so we make sure that now everything is fine. $fields['url'] = System::baseUrl() . '/profile/' . $user['nickname'];