ability to open old posts without UUID

This commit is contained in:
2026-07-16 13:17:44 +03:00
parent 7ceae1c81e
commit 975c3f1909
2 changed files with 33 additions and 7 deletions
+31 -5
View File
@@ -7,7 +7,6 @@ use Zotlabs\Web\Controller;
class Link extends Controller {
function init() {
}
function get() {
@@ -20,7 +19,7 @@ class Link extends Controller {
return;
}
$r = q("select uuid from item where id = %d limit 1",
$r = q("select uuid, mid from item where id = %d limit 1",
intval($item_id)
);
@@ -29,12 +28,39 @@ class Link extends Controller {
return;
}
if (get_config('link','hideasides')) {
goaway(z_root() . '/display/' . $r[0]['uuid'] . '?link_hideasides=1');
$identifier = $r[0]['uuid'] ?? '';
if (!$identifier) {
if ($r[0]['mid']) {
$identifier = 'b64.' . base64url_encode($r[0]['mid']);
}
}
goaway(z_root() . '/display/' . $r[0]['uuid']);
if (!$identifier) {
notice( t('Item not found.') . EOL);
return;
}
$old_argv = \App::$argv;
$old_argc = \App::$argc;
\App::$argv = ['display', $identifier];
\App::$argc = 2;
$display = new Display();
$output = $display->get();
\App::$argv = $old_argv;
\App::$argc = $old_argc;
$separator = ' - ';
$page_title = \App::$page['title'];
if (substr($page_title, -strlen($separator)) === $separator) {
$page_title = substr($page_title, 0, -strlen($separator));
}
\App::$page['title'] = $page_title;
return $output;
}
}