diff --git a/src/Artemis.Core/Services/Storage/Interfaces/IProfileService.cs b/src/Artemis.Core/Services/Storage/Interfaces/IProfileService.cs index d6fa0eca7..71209fc8d 100644 --- a/src/Artemis.Core/Services/Storage/Interfaces/IProfileService.cs +++ b/src/Artemis.Core/Services/Storage/Interfaces/IProfileService.cs @@ -120,14 +120,6 @@ public interface IProfileService : IArtemisService Task ImportProfile(Stream archiveStream, ProfileCategory category, bool makeUnique, bool markAsFreshImport, string? nameAffix = "imported", ProfileConfiguration? target = null); - /// - /// Imports the provided ZIP archive stream into the provided profile configuration - /// - /// The zip archive containing the profile to import. - /// The profile configuration to overwrite. - /// The resulting profile configuration. - Task OverwriteProfile(MemoryStream archiveStream, ProfileConfiguration profileConfiguration); - /// /// Adapts a given profile to the currently active devices. /// diff --git a/src/Artemis.Core/Services/Storage/ProfileService.cs b/src/Artemis.Core/Services/Storage/ProfileService.cs index f3c4dca4e..981f247a5 100644 --- a/src/Artemis.Core/Services/Storage/ProfileService.cs +++ b/src/Artemis.Core/Services/Storage/ProfileService.cs @@ -434,18 +434,6 @@ internal class ProfileService : IProfileService return profileConfiguration; } - /// - public async Task OverwriteProfile(MemoryStream archiveStream, ProfileConfiguration profileConfiguration) - { - ProfileConfiguration imported = await ImportProfile(archiveStream, profileConfiguration.Category, true, false, null, profileConfiguration); - imported.Name = profileConfiguration.Name; - - RemoveProfileConfiguration(profileConfiguration); - SaveProfileCategory(imported.Category); - - return imported; - } - /// public void AdaptProfile(Profile profile) { diff --git a/src/Artemis.WebClient.Workshop/Handlers/InstallationHandlers/Implementations/ProfileEntryInstallationHandler.cs b/src/Artemis.WebClient.Workshop/Handlers/InstallationHandlers/Implementations/ProfileEntryInstallationHandler.cs index 6df1aaead..d702681a4 100644 --- a/src/Artemis.WebClient.Workshop/Handlers/InstallationHandlers/Implementations/ProfileEntryInstallationHandler.cs +++ b/src/Artemis.WebClient.Workshop/Handlers/InstallationHandlers/Implementations/ProfileEntryInstallationHandler.cs @@ -42,11 +42,16 @@ public class ProfileEntryInstallationHandler : IEntryInstallationHandler ProfileConfiguration? existing = _profileService.ProfileCategories.SelectMany(c => c.ProfileConfigurations).FirstOrDefault(c => c.ProfileId == profileId); if (existing != null) { - ProfileConfiguration overwritten = await _profileService.OverwriteProfile(stream, existing); + ProfileConfiguration overwritten = await _profileService.ImportProfile(stream, existing.Category, true, false, null, existing); + overwritten.Name = existing.Name; + + // Update the release installedEntry.SetMetadata("ProfileId", overwritten.ProfileId); - - // Update the release and return the profile configuration UpdateRelease(installedEntry, release); + + // With everything updated, remove the old profile + _profileService.RemoveProfileConfiguration(existing); + return EntryInstallResult.FromSuccess(installedEntry); } }