Files
projectsend/app/Modules/Platform/Http/Controllers/WhatsNewController.php
T
ignacionelson 6ddfc1aa5d Greet the administrator once, on the first visit after an update
An update finished and nothing said so. The dashboard looked identical to
yesterday's, and whatever the release brought was in a file nobody opens.

The first time the installation's administrator opens ProjectSend after
an update, they now land on a page that names the version they are on,
invites them to the Discord — the same invitation update.sh prints, made
again where they are actually looking — and then lays out what the
release brought.

The notes come from CHANGELOG.md inside the release, not from GitHub: the
one moment this page exists for is the moment after an update, possibly
on a server with no outbound access, describing code already on disk.
Parsed rather than rendered, so nothing in it can become HTML.

Once, and to one person. The update happened to the installation, so
greeting five staff members — each having to dismiss a page they did not
ask for — would turn a pleasant moment into a support question. It goes
to the oldest active administrator, which on any installation that went
through setup is whoever set it up. No owner flag was invented for this:
administrators are equal in authority, and changing that for a greeting
is not a trade worth making.

Only forwards, and only for a real update. A fresh install has nothing to
catch up on, a container reboot has not updated anything, and somebody
restoring an older release is dealing with a problem rather than
celebrating. Managed installations never see it at all — nobody signed in
there performed the update it thanks them for, which is the same gate the
System card and About's environment block already carry.

The redirect is attached to the dashboard alone, not the web group: it
catches a login and the sidebar logo both, without ever interrupting a
download to congratulate somebody. Reading the page clears the marker,
but the address keeps working — closing it by accident should not be
unrecoverable — and About now links to it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-15 14:22:17 -03:00

53 lines
1.8 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Modules\Platform\Http\Controllers;
use App\Http\Controllers\Controller;
use App\Modules\Platform\Updates\UpdateWelcome;
use Illuminate\Http\Request;
use Inertia\Inertia;
use Inertia\Response;
/**
* The screen an administrator lands on the first time they open
* ProjectSend after an update: what it is now running, an invitation to
* the place where the people are, and then what the release actually
* brought.
*
* That order is the design. The thanks and the invitation are for the
* person who just did the work — a moment that exists exactly once per
* update and is otherwise spent staring at a dashboard that looks
* identical to yesterday's. The release notes are underneath because
* they are the part that can be read later, or not at all.
*/
class WhatsNewController extends Controller
{
public function __construct(private readonly UpdateWelcome $welcome) {}
public function __invoke(Request $request): Response
{
$user = $request->user();
assert($user !== null);
// Read before dismissing: everything below describes the update
// that the next line forgets.
$props = [
'version' => $this->welcome->version(),
'previousVersion' => $this->welcome->previousVersion(),
'justUpdated' => $this->welcome->isFresh(),
'releases' => $this->welcome->releases(),
];
// Only for the person it was addressed to. Another administrator
// opening the page from a link is reading, not receiving, and must
// not consume a greeting meant for somebody else.
if ($this->welcome->isWaitingFor($user)) {
$this->welcome->dismiss();
}
return Inertia::render('system/whats-new', $props);
}
}