From 295808fb30a8bb4fab862852fc6c0c39d1f8a7c1 Mon Sep 17 00:00:00 2001 From: nsteenla Date: Mon, 22 Jan 2024 18:38:45 +0100 Subject: [PATCH] fix setting HasBeenPublic in cleanup command --- CHANGELOG.md | 11 ++++++++++- server/dataset.go | 2 +- server/publication.go | 20 ++++++++++---------- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4bde189a9..a74f266ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +## [v1.0.51] - 2024-01-22 + +### Added + +### Fixed + +- Fix bug in cleanup command + ## [v1.0.50] - 2024-01-22 ### Added @@ -530,7 +538,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Initial release -[unreleased]: https://github.com/ugent-library/biblio-backoffice/compare/v1.0.50...HEAD +[unreleased]: https://github.com/ugent-library/biblio-backoffice/compare/v1.0.51...HEAD +[v1.0.51]: https://github.com/ugent-library/biblio-backoffice/compare/v1.0.50...v1.0.51 [v1.0.50]: https://github.com/ugent-library/biblio-backoffice/compare/v1.0.49...v1.0.50 [v1.0.49]: https://github.com/ugent-library/biblio-backoffice/compare/v1.0.48...v1.0.49 [v1.0.48]: https://github.com/ugent-library/biblio-backoffice/compare/v1.0.47...v1.0.48 diff --git a/server/dataset.go b/server/dataset.go index 9fa377a43..744c74458 100644 --- a/server/dataset.go +++ b/server/dataset.go @@ -726,7 +726,7 @@ func (s *server) CleanupDatasets(req *api.CleanupDatasetsRequest, stream api.Bib fixed := false // correctly set HasBeenPublic (only needs to run once) - if d.Status == "deleted" && !d.HasBeenPublic { + if !d.HasBeenPublic { s.services.Repo.DatasetHistory(d.ID, func(dd *models.Dataset) bool { if dd.Status == "public" { d.HasBeenPublic = true diff --git a/server/publication.go b/server/publication.go index 5c78f2e01..f2ad7a7e3 100644 --- a/server/publication.go +++ b/server/publication.go @@ -920,16 +920,16 @@ func (s *server) CleanupPublications(req *api.CleanupPublicationsRequest, stream } // correctly set HasBeenPublic (only needs to run once) - // if p.Status == "deleted" && !p.HasBeenPublic { - // s.services.Repo.PublicationHistory(p.ID, func(pp *models.Publication) bool { - // if pp.Status == "public" { - // p.HasBeenPublic = true - // fixed = true - // return false - // } - // return true - // }) - // } + if !p.HasBeenPublic { + s.services.Repo.PublicationHistory(p.ID, func(pp *models.Publication) bool { + if pp.Status == "public" { + p.HasBeenPublic = true + fixed = true + return false + } + return true + }) + } // remove empty links (only needs to run once) // for _, l := range p.Link {