Fix: dont display trashed docs in doc links

This commit is contained in:
shamoon 2024-10-28 08:57:38 -07:00
parent fa0ab0de27
commit 3b1dffe0dc
3 changed files with 17 additions and 15 deletions

View File

@ -2231,7 +2231,7 @@
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/manage/custom-fields/custom-fields.component.ts</context>
<context context-type="linenumber">80</context>
<context context-type="linenumber">83</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/manage/mail/mail.component.ts</context>
@ -2570,7 +2570,7 @@
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/manage/custom-fields/custom-fields.component.ts</context>
<context context-type="linenumber">82</context>
<context context-type="linenumber">85</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/manage/mail/mail.component.ts</context>
@ -3265,7 +3265,7 @@
<source>View</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/common/custom-field-display/custom-field-display.component.html</context>
<context context-type="linenumber">21</context>
<context context-type="linenumber">22</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/common/input/permissions/permissions-form/permissions-form.component.html</context>
@ -3302,7 +3302,7 @@
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/manage/custom-fields/custom-fields.component.ts</context>
<context context-type="linenumber">63</context>
<context context-type="linenumber">65</context>
</context-group>
</trans-unit>
<trans-unit id="1841172489943868696" datatype="html">
@ -3313,7 +3313,7 @@
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/manage/custom-fields/custom-fields.component.ts</context>
<context context-type="linenumber">70</context>
<context context-type="linenumber">73</context>
</context-group>
</trans-unit>
<trans-unit id="4465085913683915434" datatype="html">
@ -7544,28 +7544,28 @@
<source>Confirm delete field</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/manage/custom-fields/custom-fields.component.ts</context>
<context context-type="linenumber">78</context>
<context context-type="linenumber">81</context>
</context-group>
</trans-unit>
<trans-unit id="2939457975223185057" datatype="html">
<source>This operation will permanently delete this field.</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/manage/custom-fields/custom-fields.component.ts</context>
<context context-type="linenumber">79</context>
<context context-type="linenumber">82</context>
</context-group>
</trans-unit>
<trans-unit id="5137089475515834162" datatype="html">
<source>Deleted field</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/manage/custom-fields/custom-fields.component.ts</context>
<context context-type="linenumber">88</context>
<context context-type="linenumber">91</context>
</context-group>
</trans-unit>
<trans-unit id="6352403551920829405" datatype="html">
<source>Error deleting field.</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/manage/custom-fields/custom-fields.component.ts</context>
<context context-type="linenumber">93</context>
<context context-type="linenumber">97</context>
</context-group>
</trans-unit>
<trans-unit id="8084492669582894778" datatype="html">

View File

@ -18,9 +18,11 @@
@case (CustomFieldDataType.DocumentLink) {
<div [ngbTooltip]="nameTooltip" class="d-flex gap-1 flex-wrap">
@for (docId of value; track docId) {
<a routerLink="/documents/{{docId}}" class="badge bg-body text-primary" title="View" i18n-title>
<i-bs width="0.9em" height="0.9em" name="file-text"></i-bs>&nbsp;<span>{{ getDocumentTitle(docId) }}</span>
</a>
@if (getDocumentTitle(docId)) {
<a routerLink="/documents/{{docId}}" class="badge bg-body text-primary" title="View" i18n-title>
<i-bs width="0.9em" height="0.9em" name="file-text"></i-bs>&nbsp;<span>{{ getDocumentTitle(docId) }}</span>
</a>
}
}
</div>
}

View File

@ -71,9 +71,9 @@ export class DocumentLinkComponent
.pipe(takeUntil(this.unsubscribeNotifier))
.subscribe((documentResults) => {
this.loading = false
this.selectedDocuments = documentIDs.map((id) =>
documentResults.results.find((d) => d.id === id)
)
this.selectedDocuments = documentIDs
.map((id) => documentResults.results.find((d) => d.id === id))
.filter((d) => d)
super.writeValue(documentIDs)
})
}