From 5c73644cb175bafd59fa7b02c37e9313c9f31c24 Mon Sep 17 00:00:00 2001 From: Mike Macgirvin Date: Thu, 9 May 2024 19:07:18 +1000 Subject: [PATCH 1/3] Normalise textarea line endings from CRLF to LF. This also needs to happen in other textareas that support multicode, but we'll start here. --- src/Module/Item.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Module/Item.php b/src/Module/Item.php index b7773b3e3..87af0ed29 100644 --- a/src/Module/Item.php +++ b/src/Module/Item.php @@ -892,6 +892,10 @@ class Item extends Controller $allow_empty = ((($checkin || $checkout) && $haslocation) || $_REQUEST['allow_empty']); $private = ((isset($private) && $private) ? $private : intval($acl->is_private() || ($public_policy))); + // Normalise the line endings on multi-line fields. + $summary = str_replace("\r\n", "\n", $summary); + $body = str_replace("\r\n", "\n", $body); + // If this is a comment, set the permissions from the parent. if ($parent_item) { From 634608fe01db6f6cb6ebf425314da8a44d4f9e7e Mon Sep 17 00:00:00 2001 From: Mike Macgirvin Date: Fri, 10 May 2024 04:24:58 +1000 Subject: [PATCH 2/3] fix k&t url, add followers to "upstream" public comments on uncontained conversations --- README.md | 2 +- src/Daemon/Notifier.php | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6698cb8f6..cf5cc060e 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ A Yunohost install is present in https://apps.yunohost.org/app/streams Managed hosting is available from -https://knthost.com +https://knthost.com/streams Language translation instructions are provided in https://codeberg.org/streams/streams/src/branch/release/util/README diff --git a/src/Daemon/Notifier.php b/src/Daemon/Notifier.php index b54e8661c..1e86b19d4 100644 --- a/src/Daemon/Notifier.php +++ b/src/Daemon/Notifier.php @@ -443,9 +443,12 @@ class Notifier implements DaemonInterface self::$private = true; $upstream = true; self::$packet_type = 'response'; + // send public replies to your followers if using hyperdrive or if this is not a contained conversation; + // for instance if the thread is from a microblog platform. + $isContained = str_contains($parent_item['tgt_type'], 'Collection') || ($parent_item['item_restrict'] & 4); $is_moderated = their_perms_contains($parent_item['uid'], (is_array($sendto) ? $sendto[0] : $sendto), 'moderated'); if ($relay_to_owner && $thread_is_public && (! $is_moderated) && (! $question) && (! Channel::is_group($parent_item['uid']))) { - if (get_pconfig($target_item['uid'], 'system', 'hyperdrive', true)) { + if (get_pconfig($target_item['uid'], 'system', 'hyperdrive', true) || !$isContained) { Run::Summon([ 'Notifier' , 'hyper', $item_id ]); } } From 2d4eef22d6566dc1a10021b03b7089be05721718 Mon Sep 17 00:00:00 2001 From: Mike Macgirvin Date: Fri, 10 May 2024 07:56:35 +1000 Subject: [PATCH 3/3] some ux work on permcats (Roles) --- src/Lib/Permcat.php | 26 +++++++++++++++++++++++++- src/Module/Settings/Permcats.php | 6 ++---- view/tpl/settings_permcats.tpl | 5 +++-- 3 files changed, 30 insertions(+), 7 deletions(-) diff --git a/src/Lib/Permcat.php b/src/Lib/Permcat.php index ecfd25ced..d138d80a2 100644 --- a/src/Lib/Permcat.php +++ b/src/Lib/Permcat.php @@ -177,7 +177,10 @@ class Permcat if ($x) { foreach ($x as $xv) { $value = unserialise($xv['v']); - $permcats[] = [ $xv['k'], $xv['k'], $value, 0 ]; + if ($this->system_override($permcats, $xv)) { + $permcats = $this->system_remove($permcats, $xv); + } + $permcats[] = [$xv['k'], $xv['k'], $value, 0]; } } } @@ -202,6 +205,27 @@ class Permcat return $permcats; } + public function system_override($permcats, $entry) + { + foreach ($permcats as $permcat) { + if (($entry['k'] === $permcat[0] || $entry['k'] === $permcat[1]) && $permcat[3]) { + return true; + } + } + return false; + } + public function system_remove($permcats, $entry) + { + $retval = []; + foreach ($permcats as $permcat) { + if (($entry['k'] === $permcat[0] || $entry['k'] === $permcat[1]) && $permcat[3]) { + continue; + } + $retval[] = $permcat; + } + return $retval; + } + public static function find_permcat($arr, $name) { if ($arr && $name) { diff --git a/src/Module/Settings/Permcats.php b/src/Module/Settings/Permcats.php index e98bc6a30..88c3ebc3c 100644 --- a/src/Module/Settings/Permcats.php +++ b/src/Module/Settings/Permcats.php @@ -85,12 +85,10 @@ class Permcats $permcats = []; if ($pcatlist) { foreach ($pcatlist as $pc) { - if (($pc['name']) && ($name) && ($pc['name'] == $name)) { + if (($pc['name']) && $name && ($pc['name'] == $name)) { $existing = $pc['perms']; } - if (!$pc['system']) { - $permcats[bin2hex($pc['name'])] = $pc['localname']; - } + $permcats[bin2hex($pc['name'])] = ['name' => $pc['localname'], 'system' => $pc['system']]; } } diff --git a/view/tpl/settings_permcats.tpl b/view/tpl/settings_permcats.tpl index f4c32f9d5..076572042 100644 --- a/view/tpl/settings_permcats.tpl +++ b/view/tpl/settings_permcats.tpl @@ -54,8 +54,9 @@ {{foreach $permcats as $k => $v}} - - + + + {{/foreach}}
{{$v}}{{$v.name}}{{if $v.system}} {{else}}{{/if}}