feat(publish): a release keeps its colour, and a description for Explore

Publishing takes a description for Explore (rich text, as its JSON),
which Explore shows in place of the studyset's own: a studyset may
introduce itself to strangers otherwise than in the library, where its
author may leave it empty. Without one, as from older apps, the
studyset's description as before; one that isn't rich text, or over
100,000 characters, counts as none. A release also keeps the studyset's
colour, which Explore gives out with it; releases before have none. The
publication's releases say their description, for the next publish to
start from.

Migration release-colour adds a nullable column:
ALTER TABLE "studyset_release" ADD COLUMN "colorName" text;
the server before it reads and writes the table as ever.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
Tizian 「ティツィアーン」 2026-10-14 17:40:33 +02:00
commit fe6b1f5ed1
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64

View file

@ -162,6 +162,7 @@ void main() {
'license': ?license,
'licenseHolder': 'Alice',
'study': {'newPerDay': 10},
'color': 'cobalt',
'published': ?copyOf,
'examPlans': [
{
@ -528,6 +529,47 @@ void main() {
);
});
test("a release keeps the studyset's colour, and what its author wrote "
'for Explore as its description; what is no rich text counts as '
'nothing written', () async {
await profile(alice, 'alice');
final content = await japanese(alice);
final about = jsonEncode({
'formatVersion': 1,
'editor': {
'document': {'type': 'page'},
},
});
final published = await endpoints.publish.publish(
signedIn(alice),
content.root,
'japanese',
'',
description: about,
);
expect(published.releases.single.description, about);
final kept = await StudysetRelease.db.find(session);
expect(kept.single.colorName, 'cobalt');
expect(kept.single.description, about);
await revise(
alice,
content.word,
await revisionsOf(content.word),
'日本語',
);
final second = await endpoints.publish.publish(
signedIn(alice),
content.root,
'japanese',
'',
description: 'not rich text',
);
expect(second.releases.first.description, isNull);
});
test(
'a version git has but the database lost is never given again',
() async {