Fix: fix unshared items display

This commit is contained in:
shamoon 2025-03-28 05:47:10 -07:00
parent fd45e81a83
commit b4b2a92225
No known key found for this signature in database
3 changed files with 11 additions and 4 deletions

View File

@ -5461,7 +5461,11 @@
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/pipes/object-name.pipe.ts</context>
<context context-type="linenumber">43</context>
<context context-type="linenumber">40</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/pipes/object-name.pipe.ts</context>
<context context-type="linenumber">46</context>
</context-group>
</trans-unit>
<trans-unit id="2504502765849142619" datatype="html">

View File

@ -50,7 +50,7 @@ describe('ObjectNamePipe', () => {
})
})
it('should return empty string if object not found', (done) => {
it('should return Private string if object not found', (done) => {
const mockObjects = {
results: [{ id: 2, name: 'Object 2' }],
count: 1,
@ -60,7 +60,7 @@ describe('ObjectNamePipe', () => {
jest.spyOn(objectService, 'listAll').mockReturnValue(of(mockObjects))
pipe.transform(1).subscribe((result) => {
expect(result).toBe('')
expect(result).toBe('Private')
done()
})
})

View File

@ -35,7 +35,10 @@ export abstract class ObjectNamePipe implements PipeTransform {
return this.objectService.listAll().pipe(
map((objects) => {
this.objects = objects.results
return this.objects.find((o) => o.id === obejctId)?.name || ''
return (
this.objects.find((o) => o.id === obejctId)?.name ||
$localize`Private`
)
}),
catchError(() => of(''))
)