Merge branch 'dev' into nomadic

This commit is contained in:
Mike Macgirvin 2024-05-10 08:27:14 +10:00
commit 7a5d6760b4
6 changed files with 39 additions and 9 deletions

View file

@ -27,7 +27,7 @@ A Yunohost install is present in
https://apps.yunohost.org/app/streams https://apps.yunohost.org/app/streams
Managed hosting is available from Managed hosting is available from
https://knthost.com https://knthost.com/streams
Language translation instructions are provided in Language translation instructions are provided in
https://codeberg.org/streams/streams/src/branch/release/util/README https://codeberg.org/streams/streams/src/branch/release/util/README

View file

@ -443,9 +443,12 @@ class Notifier implements DaemonInterface
self::$private = true; self::$private = true;
$upstream = true; $upstream = true;
self::$packet_type = 'response'; 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'); $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 ($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 ]); Run::Summon([ 'Notifier' , 'hyper', $item_id ]);
} }
} }

View file

@ -177,7 +177,10 @@ class Permcat
if ($x) { if ($x) {
foreach ($x as $xv) { foreach ($x as $xv) {
$value = unserialise($xv['v']); $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; 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) public static function find_permcat($arr, $name)
{ {
if ($arr && $name) { if ($arr && $name) {

View file

@ -896,6 +896,10 @@ class Item extends Controller
$allow_empty = ((($checkin || $checkout) && $haslocation) || $_REQUEST['allow_empty']); $allow_empty = ((($checkin || $checkout) && $haslocation) || $_REQUEST['allow_empty']);
$private = ((isset($private) && $private) ? $private : intval($acl->is_private() || ($public_policy))); $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 this is a comment, set the permissions from the parent.
if ($parent_item) { if ($parent_item) {

View file

@ -85,12 +85,10 @@ class Permcats
$permcats = []; $permcats = [];
if ($pcatlist) { if ($pcatlist) {
foreach ($pcatlist as $pc) { foreach ($pcatlist as $pc) {
if (($pc['name']) && ($name) && ($pc['name'] == $name)) { if (($pc['name']) && $name && ($pc['name'] == $name)) {
$existing = $pc['perms']; $existing = $pc['perms'];
} }
if (!$pc['system']) { $permcats[bin2hex($pc['name'])] = ['name' => $pc['localname'], 'system' => $pc['system']];
$permcats[bin2hex($pc['name'])] = $pc['localname'];
}
} }
} }

View file

@ -54,8 +54,9 @@
<table id="permcat-index"> <table id="permcat-index">
{{foreach $permcats as $k => $v}} {{foreach $permcats as $k => $v}}
<tr class="permcat-row-{{$k}}"> <tr class="permcat-row-{{$k}}">
<td width="99%"><a href="settings/permcats/{{$k}}">{{$v}}</a></td>
<td width="1%"><i class="fa fa-trash-o drop-icons" onClick="dropItem('/settings/permcats/{{$k}}/drop', '.permcat-row-{{$k}}')"></i></td> <td style="width:99%;"><a href="settings/permcats/{{$k}}">{{$v.name}}</a></td>
<td style="width:1%;">{{if $v.system}}&nbsp;{{else}}<i class="fa fa-trash-o drop-icons" onClick="dropItem('/settings/permcats/{{$k}}/drop', '.permcat-row-{{$k}}');"></i>{{/if}}</td>
</tr> </tr>
{{/foreach}} {{/foreach}}
</table> </table>