Skip to content

Commit

Permalink
Clean up draft version pipe
Browse files Browse the repository at this point in the history
  • Loading branch information
ybnd committed Feb 7, 2024
1 parent 54a720f commit d9bcbe4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
13 changes: 6 additions & 7 deletions src/app/core/data/version-history-data.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,14 +170,13 @@ export class VersionHistoryDataService extends IdentifiableDataService<VersionHi
hasDraftVersion$(versionHref: string): Observable<boolean> {
return this.versionDataService.findByHref(versionHref, false, true, followLink('versionhistory')).pipe(
getFirstCompletedRemoteData(),
switchMap((res) => {
if (res.hasSucceeded && !res.hasNoContent) {
return res.payload.versionhistory.pipe(
switchMap((versionRD: RemoteData<Version>) => {
if (versionRD.hasSucceeded && !versionRD.hasNoContent) {
return versionRD.payload.versionhistory.pipe(
getFirstCompletedRemoteData(),
map((versionHistoryRD) => {
if (res.hasSucceeded) {
const versionHistory = versionHistoryRD.payload;
return versionHistory ? versionHistory.draftVersion : false;
map((versionHistoryRD: RemoteData<VersionHistory>) => {
if (versionHistoryRD.hasSucceeded && !versionHistoryRD.hasNoContent) {
return versionHistoryRD.payload.draftVersion;
} else {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export class DsoVersioningModalService {
// button is disabled if hasDraftVersion = true, and enabled if hasDraftVersion = false or null
// (hasDraftVersion is null when a version history does not exist)
map((res) => Boolean(res)),
startWith(true),
// startWith(true),
);
}

Expand Down

0 comments on commit d9bcbe4

Please sign in to comment.