cat-documents-ng 1.0.62 → 1.0.63
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -2768,9 +2768,10 @@ class DocumentViewerService {
|
|
|
2768
2768
|
const alertData = this.getAlertData(document);
|
|
2769
2769
|
const documentStatus = this.calculateDocumentStatus(document);
|
|
2770
2770
|
const documentIsUploaded = this.calculateIsDocumentUploaded(document);
|
|
2771
|
-
this.documentStore.updateDocumentViewerState(document,
|
|
2772
|
-
if (!skipLoadDocumentHistory && document?._id)
|
|
2771
|
+
this.documentStore.updateDocumentViewerState(document, [], false, undefined, documentStatus, documentIsUploaded, alertData);
|
|
2772
|
+
if (!skipLoadDocumentHistory && document?._id) {
|
|
2773
2773
|
this.loadDocumentHistory(document._id);
|
|
2774
|
+
}
|
|
2774
2775
|
}
|
|
2775
2776
|
/**
|
|
2776
2777
|
* Loads document history data
|
|
@@ -2778,25 +2779,39 @@ class DocumentViewerService {
|
|
|
2778
2779
|
*/
|
|
2779
2780
|
// eslint-disable-next-line max-lines-per-function
|
|
2780
2781
|
loadDocumentHistory(documentId) {
|
|
2781
|
-
if (documentId) {
|
|
2782
|
-
|
|
2783
|
-
.subscribe({
|
|
2784
|
-
/**
|
|
2785
|
-
* Stores the fetched document history in state.
|
|
2786
|
-
* @param {DocumentHistorySection[]} history - The fetched document history
|
|
2787
|
-
*/
|
|
2788
|
-
next: (history) => {
|
|
2789
|
-
this.documentStore.updateDocumentViewerState(undefined, history, true);
|
|
2790
|
-
},
|
|
2791
|
-
/**
|
|
2792
|
-
* Clears document history loading state on error.
|
|
2793
|
-
* @param {any} error - The fetch error
|
|
2794
|
-
*/
|
|
2795
|
-
error: (error) => {
|
|
2796
|
-
this.documentStore.updateDocumentViewerState(undefined, undefined, false);
|
|
2797
|
-
}
|
|
2798
|
-
});
|
|
2782
|
+
if (!documentId) {
|
|
2783
|
+
return;
|
|
2799
2784
|
}
|
|
2785
|
+
this.documentHttpService.getDocumentHistory(documentId)
|
|
2786
|
+
.subscribe({
|
|
2787
|
+
/**
|
|
2788
|
+
* Stores the fetched document history in state.
|
|
2789
|
+
* @param {DocumentHistorySection[]} history - The fetched document history
|
|
2790
|
+
*/
|
|
2791
|
+
next: (history) => {
|
|
2792
|
+
if (!this.isHistoryResponseForCurrentDocument(documentId)) {
|
|
2793
|
+
return;
|
|
2794
|
+
}
|
|
2795
|
+
this.documentStore.updateDocumentViewerState(undefined, history, true);
|
|
2796
|
+
},
|
|
2797
|
+
/**
|
|
2798
|
+
* Clears document history loading state on error.
|
|
2799
|
+
* @param {any} error - The fetch error
|
|
2800
|
+
*/
|
|
2801
|
+
error: () => {
|
|
2802
|
+
if (!this.isHistoryResponseForCurrentDocument(documentId)) {
|
|
2803
|
+
return;
|
|
2804
|
+
}
|
|
2805
|
+
this.documentStore.updateDocumentViewerState(undefined, [], false);
|
|
2806
|
+
}
|
|
2807
|
+
});
|
|
2808
|
+
}
|
|
2809
|
+
/**
|
|
2810
|
+
* Ensures async history responses only apply to the currently selected document.
|
|
2811
|
+
* @param documentId The document ID the history request was made for
|
|
2812
|
+
*/
|
|
2813
|
+
isHistoryResponseForCurrentDocument(documentId) {
|
|
2814
|
+
return this.documentQuery.getDocumentViewerState().selectedDocument?._id === documentId;
|
|
2800
2815
|
}
|
|
2801
2816
|
/**
|
|
2802
2817
|
* Determines if the given content type is an image
|