Add special profile upgrade system

This commit is contained in:
Daniel
2021-05-05 13:01:58 +02:00
parent 94756d9f38
commit 6245bca6d9
2 changed files with 88 additions and 1 deletions

View File

@@ -51,6 +51,12 @@ func GetProfile(source profileSource, id, linkedPath string) ( //nolint:gocognit
// Get from database.
profile, err = getProfile(scopedID)
// Check if the request is for a special profile that may need a reset.
if err == nil && specialProfileNeedsReset(profile) {
// Trigger creation of special profile.
err = database.ErrNotFound
}
// If we cannot find a profile, check if the request is for a special
// profile we can create.
if errors.Is(err, database.ErrNotFound) {