mirror of
https://github.com/projectsend/projectsend.git
synced 2026-09-21 02:53:24 +00:00
99c8c469c5
Client file rows in My files now carry expires_at, and all four portal themes show "Available until <date>" beside the size, date and download count. Before, the date was only on the file's edit screen, so a file about to disappear gave no sign of it where the client looks for it. The portal upload page dispatches ResolvingUploadNotice, handing the uploader to listeners, and shows any lines they add above the uploader. The upload page is one page for every theme, so this is the only place a rule about uploads can be read before one happens; the announcement band is drawn by one theme's shell and would miss the other three. With nothing listening it shows nothing. First caller: cloud-modules, telling free-plan customers how long uploads are kept.
41 lines
1.1 KiB
PHP
41 lines
1.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Modules\Files\Events;
|
|
|
|
use App\Models\User;
|
|
|
|
/**
|
|
* Something a client should read before they upload.
|
|
*
|
|
* Asked each time the portal's upload page is rendered, and shown above
|
|
* the uploader in every theme. The upload page is one page for all of
|
|
* them, so this is the one place a rule about what happens to an upload
|
|
* can be said where the upload happens — the announcement band is not,
|
|
* since only one theme's shell draws it.
|
|
*
|
|
* **Core knows nothing about what it says.** The first caller is the
|
|
* hosted edition's shared instance, telling a free customer how long
|
|
* their files are kept, which is a rule of one offering and belongs in
|
|
* that offering's code.
|
|
*
|
|
* Lines rather than one message: two unrelated rules can both apply, and
|
|
* neither listener can know the other exists. Each line is a sentence,
|
|
* already translated.
|
|
*/
|
|
class ResolvingUploadNotice
|
|
{
|
|
/** @var list<string> */
|
|
public array $lines = [];
|
|
|
|
public function __construct(
|
|
public readonly User $uploader,
|
|
) {}
|
|
|
|
public function add(string $line): void
|
|
{
|
|
$this->lines[] = $line;
|
|
}
|
|
}
|