Foto del profilo: uno schema dei nomi proprio (#38)
Alberto ha deciso che le foto del profilo stanno dentro ogni account, in
<account>\profilo. Con un solo schema generale bastava cambiarlo perché
finissero insieme ai post: ora hanno il loro schema, come le raccolte in
evidenza, predefinito {account}\profilo\{data}_{ora}_{codice}_{n}, senza la
cartella dell'anno.
Impostazioni > Generali mostra il terzo campo con la cartella nel risultato
e colora solo il campo sbagliato. Un salvataggio che non manda il terzo
schema tiene quello salvato. Importazione e ricostruzione del database
riconoscono la cartella; prove nuove per nomi, impostazioni, salvataggio,
importazione e ricostruzione. Schermata confrontata con il mockup 08.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
305791f57b
commit
72deb212a7
19 files changed
+340
-69
No files matched your search
@@ -135,6 +135,36 @@ public sealed class LibraryRebuildTests
|
||||
Assert.AreEqual(again.Media[0].RelativePath, (await library.Db.Media.ListByEntryAsync(restored.Id))[0].RelativePath);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task ProfilePicturesComeBackFromTheirOwnFolder()
|
||||
{
|
||||
// #38: the pictures have their own scheme (no year folder, outside the general scheme); the rebuild reads them
|
||||
// from the journal wherever that scheme put them.
|
||||
using var temp = new TempFolder();
|
||||
await using var library = await TestLibrary.CreateAsync(temp);
|
||||
library.Ingest.Apply(LibraryNaming.Default with { ProfilePicture = NamingScheme.Parse(@"{account}\foto\{data}_{codice}", NamingSchemeUse.ProfilePicture) }, true);
|
||||
var marta = await library.Db.Accounts.AddAsync(Make.Account("marta.demo", "100"));
|
||||
var first = await library.SaveAsync(marta, Make.Entry(marta.Id, "pp1", Make.T0.AddDays(-30), EntryKind.ProfilePicture), [TestFile.Photo(1, 1)]);
|
||||
var second = await library.SaveAsync(marta, Make.Entry(marta.Id, "pp2", Make.T0, EntryKind.ProfilePicture), [TestFile.Photo(1, 2)]);
|
||||
StringAssert.StartsWith(first.Media[0].RelativePath, "foto/");
|
||||
|
||||
await library.LoseDatabaseAsync();
|
||||
var report = await new LibraryRebuilder(library.Db, library.Layout, library.Clock).RebuildAsync();
|
||||
|
||||
Assert.AreEqual(2, report.EntriesCreated);
|
||||
Assert.AreEqual(0, report.UntrackedFiles);
|
||||
var account = (await library.Db.Accounts.FindByInstagramIdAsync("100"))!;
|
||||
var pictures = await library.Db.Entries.ListByAccountAsync(account.Id, new EntryListOptions { Kind = EntryKind.ProfilePicture });
|
||||
Assert.HasCount(2, pictures);
|
||||
var paths = new List<string?>();
|
||||
foreach (var picture in pictures)
|
||||
{
|
||||
paths.AddRange((await library.Db.Media.ListByEntryAsync(picture.Id)).Select(m => m.RelativePath));
|
||||
}
|
||||
|
||||
CollectionAssert.AreEquivalent(new[] { first.Media[0].RelativePath, second.Media[0].RelativePath }, paths);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task AnEmptyLibraryRebuildsNothing()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user