Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix update project model name #4373

Merged
merged 7 commits into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@ public Model createAsset(final Model asset, final UUID projectId, final Schema.P
});
}

if (asset.getHeader() != null && asset.getHeader().getName() != null) {
asset.setName(asset.getHeader().getName());
}
final Model created = super.createAsset(asset, projectId, hasWritePermission);

if (created.getPublicAsset() && !created.getTemporary()) {
Expand Down Expand Up @@ -172,6 +175,9 @@ public Optional<Model> updateAsset(
final UUID projectId,
final Schema.Permission hasWritePermission
) throws IOException, IllegalArgumentException {
if (asset.getHeader() != null && asset.getHeader().getName() != null) {
asset.setName(asset.getHeader().getName());
}
final Optional<Model> updatedOptional = super.updateAsset(asset, projectId, hasWritePermission);
if (updatedOptional.isEmpty()) {
return Optional.empty();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,6 @@ public Optional<ProjectAsset> createProjectAsset(
projectAsset.setAssetType(assetType);
projectAsset.setAssetName(asset.getName());

if (asset instanceof Model) {
projectAsset.setAssetName(((Model) asset).getHeader().getName());
}

projectAsset = projectAssetRepository.save(projectAsset);

project.getProjectAssets().add(projectAsset);
Expand Down
Loading