Fix/refactor: remove doc observables, fix username async (#8908)

This commit is contained in:
shamoon
2025-01-25 12:38:36 -08:00
committed by GitHub
parent 8f9a294529
commit f3cda54cd1
30 changed files with 509 additions and 220 deletions

View File

@@ -14,7 +14,7 @@ import {
} from '@ng-bootstrap/ng-bootstrap'
import { NgxBootstrapIconsModule } from 'ngx-bootstrap-icons'
import { of } from 'rxjs'
import { delay, map } from 'rxjs/operators'
import { delay } from 'rxjs/operators'
import {
DEFAULT_DISPLAY_FIELDS,
DisplayField,
@@ -22,9 +22,12 @@ import {
} from 'src/app/data/document'
import { SETTINGS_KEYS } from 'src/app/data/ui-settings'
import { IfPermissionsDirective } from 'src/app/directives/if-permissions.directive'
import { CorrespondentNamePipe } from 'src/app/pipes/correspondent-name.pipe'
import { CustomDatePipe } from 'src/app/pipes/custom-date.pipe'
import { DocumentTitlePipe } from 'src/app/pipes/document-title.pipe'
import { DocumentTypeNamePipe } from 'src/app/pipes/document-type-name.pipe'
import { IsNumberPipe } from 'src/app/pipes/is-number.pipe'
import { StoragePathNamePipe } from 'src/app/pipes/storage-path-name.pipe'
import { UsernamePipe } from 'src/app/pipes/username.pipe'
import { DocumentService } from 'src/app/services/rest/document.service'
import { SettingsService } from 'src/app/services/settings.service'
@@ -45,6 +48,9 @@ import { LoadingComponentWithPermissions } from '../../loading-component/loading
CustomFieldDisplayComponent,
AsyncPipe,
UsernamePipe,
CorrespondentNamePipe,
DocumentTypeNamePipe,
StoragePathNamePipe,
IfPermissionsDirective,
CustomDatePipe,
RouterModule,
@@ -117,22 +123,14 @@ export class DocumentCardSmallComponent
return this.documentService.getDownloadUrl(this.document.id)
}
get privateName() {
return $localize`Private`
}
getTagsLimited$() {
get tagIDs() {
const limit = this.document.notes.length > 0 ? 6 : 7
return this.document.tags$?.pipe(
map((tags) => {
if (tags.length > limit) {
this.moreTags = tags.length - (limit - 1)
return tags.slice(0, limit - 1)
} else {
return tags
}
})
)
if (this.document.tags.length > limit) {
this.moreTags = this.document.tags.length - (limit - 1)
return this.document.tags.slice(0, limit - 1)
} else {
return this.document.tags
}
}
mouseLeaveCard() {