From 833b097f3def6699f87536adefae1e7e38ce2ee1 Mon Sep 17 00:00:00 2001 From: pezcurrel Date: Sun, 25 Aug 2024 00:00:08 +0200 Subject: [PATCH] Moderated instances and instances moderating are now linked to their card only if they run Mastodon and the last successful check on them is after the graceline --- web/site/instances.php | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/web/site/instances.php b/web/site/instances.php index 460099f..595e6e9 100644 --- a/web/site/instances.php +++ b/web/site/instances.php @@ -736,14 +736,18 @@ while ($if<$il && $row=mysqli_fetch_assoc($res)) { $out.='
'._('Moderated instances').'
'; if ($row['PublicBlocksList']==1) { $sevmap=['silence'=>_('limited'), 'suspend'=>_('suspended')]; - $rres=tquery("SELECT Domain, Severity, Comment, ID FROM InstBlocks LEFT JOIN Instances ON URI=Domain WHERE InstID={$row['ID']} ORDER BY Domain ASC",__LINE__); + $rres=tquery("SELECT Domain, Severity, Comment, ID, IsMastodon, LastOkCheckTS FROM InstBlocks LEFT JOIN Instances ON URI=Domain WHERE InstID={$row['ID']} ORDER BY Domain ASC",__LINE__); if (mysqli_num_rows($rres)>0) { $out.='
    '.N; while ($rrow=mysqli_fetch_assoc($rres)) { - if (!is_null($rrow['ID'])) - $out.="
  • {$rrow['Domain']}: {$sevmap[$rrow['Severity']]}"; - else - $out.="
  • {$rrow['Domain']}: {$sevmap[$rrow['Severity']]}"; + if (!is_null($rrow['ID']) && $rrow['IsMastodon']+0==1 && $rrow['LastOkCheckTS']+0>=$graceline) { + $aopen=""; + $aclose=''; + } else { + $aopen=''; + $aclose=''; + } + $out.="
  • {$aopen}{$rrow['Domain']}{$aclose}: {$sevmap[$rrow['Severity']]}"; if (!is_null($rrow['Comment'])) $out.=' ('._('reason').': '.hspech($rrow['Comment']).')';// no strip, do hspech, because moderated instances comments don’t support html nor markdown in mastodon $out.='
  • '.N; } @@ -758,11 +762,18 @@ while ($if<$il && $row=mysqli_fetch_assoc($res)) { $out.='
    '._('Instances certainly moderating this instance').'
    '; $sevmap=['silence'=>_('limitation'), 'suspend'=>_('suspension')]; - $rres=tquery("SELECT Severity, Comment, ID, URI FROM InstBlocks LEFT JOIN Instances ON ID=InstID WHERE Domain=\"{$row['URI']}\" ORDER BY URI ASC",__LINE__); + $rres=tquery("SELECT Severity, Comment, ID, URI, IsMastodon, LastOkCheckTS FROM InstBlocks LEFT JOIN Instances ON ID=InstID WHERE Domain=\"{$row['URI']}\" ORDER BY URI ASC",__LINE__); if (mysqli_num_rows($rres)>0) { $out.='
      '.N; while ($rrow=mysqli_fetch_assoc($rres)) { - $out.="
    • {$rrow['URI']}: {$sevmap[$rrow['Severity']]}
    • \n"; + if ($rrow['IsMastodon']+0==1 && $rrow['LastOkCheckTS']+0>=$graceline) { + $aopen=""; + $aclose=''; + } else { + $aopen=''; + $aclose=''; + } + $out.="
    • {$aopen}{$rrow['URI']}{$aclose}: {$sevmap[$rrow['Severity']]}
    • \n"; // if (!is_null($rrow['Comment'])) $out.=' ('._('reason').': '.hspech($rrow['Comment']).')';// no strip, do hspech, because moderated instances comments don’t support html nor markdown in mastodon // $out.=''.N; }