mirror of
https://github.com/sky-systems/sky_phone.git
synced 2026-09-04 17:23:25 +00:00
FIX - map company contacts from config
Use each company definition's validated HTTPS LogoUrl for automatic Phone contacts and populate Company or Group with the configured company name. Keep uploaded company logos as profile overrides, update browser mocks and tests, and document the required LogoUrl config field.
This commit is contained in:
@@ -166,4 +166,33 @@ describe('calls store', () => {
|
||||
expect(nuiCall).toHaveBeenNthCalledWith(2, 'contacts:list')
|
||||
expect(calls.contacts[0]?.favorite).toBe(true)
|
||||
})
|
||||
|
||||
it('keeps configured company branding on system contacts', async () => {
|
||||
vi.mocked(nuiCall).mockResolvedValueOnce({
|
||||
success: true,
|
||||
data: [
|
||||
{
|
||||
avatar_url:
|
||||
'https://picsum.photos/seed/companies-police-logo/180/180',
|
||||
companyId: 'police',
|
||||
id: 'company:police',
|
||||
name: 'Los Santos Police Department',
|
||||
organization: 'Los Santos Police Department',
|
||||
phone_number: '911',
|
||||
readonly: true,
|
||||
source: 'company',
|
||||
},
|
||||
],
|
||||
})
|
||||
const calls = useCallsStore()
|
||||
|
||||
await calls.loadContacts()
|
||||
|
||||
expect(calls.contacts[0]).toMatchObject({
|
||||
avatar_url:
|
||||
'https://picsum.photos/seed/companies-police-logo/180/180',
|
||||
organization: 'Los Santos Police Department',
|
||||
source: 'company',
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -17,7 +17,6 @@ export type PhoneContact = {
|
||||
created_at?: string
|
||||
favorite?: boolean | number
|
||||
id: string
|
||||
icon?: string
|
||||
name: string
|
||||
notes?: string | null
|
||||
organization?: string | null
|
||||
|
||||
@@ -280,7 +280,7 @@ function openContact(contact?: PhoneContact, number = ''): void {
|
||||
contactNotes.value = contact?.notes ?? ''
|
||||
contactNumber.value = contact?.phone_number ?? number
|
||||
contactAvatarMediaId.value = contact?.avatar_media_id ?? null
|
||||
contactAvatarUrl.value = contact?.avatar_url ?? contact?.icon ?? ''
|
||||
contactAvatarUrl.value = contact?.avatar_url ?? ''
|
||||
error.value = ''
|
||||
editorOpened.value = true
|
||||
}
|
||||
@@ -971,8 +971,8 @@ onBeforeUnmount(() => {
|
||||
<div class="phone-contact-hero">
|
||||
<div class="phone-contact-avatar phone-contact-avatar--large">
|
||||
<img
|
||||
v-if="selectedContact?.avatar_url || selectedContact?.icon"
|
||||
:src="selectedContact.avatar_url ?? selectedContact.icon"
|
||||
v-if="selectedContact?.avatar_url"
|
||||
:src="selectedContact.avatar_url"
|
||||
alt=""
|
||||
/>
|
||||
<span v-else-if="contactInitials(selectedNumber)">{{
|
||||
@@ -1297,8 +1297,8 @@ onBeforeUnmount(() => {
|
||||
>
|
||||
<span class="phone-contact-avatar">
|
||||
<img
|
||||
v-if="contact.avatar_url || contact.icon"
|
||||
:src="contact.avatar_url ?? contact.icon"
|
||||
v-if="contact.avatar_url"
|
||||
:src="contact.avatar_url"
|
||||
alt=""
|
||||
/>
|
||||
<template v-else>{{
|
||||
@@ -1331,8 +1331,8 @@ onBeforeUnmount(() => {
|
||||
>
|
||||
<span class="phone-contact-avatar">
|
||||
<img
|
||||
v-if="contact.avatar_url || contact.icon"
|
||||
:src="contact.avatar_url ?? contact.icon"
|
||||
v-if="contact.avatar_url"
|
||||
:src="contact.avatar_url"
|
||||
alt=""
|
||||
/>
|
||||
<template v-else>{{
|
||||
@@ -1394,8 +1394,8 @@ onBeforeUnmount(() => {
|
||||
>
|
||||
<span class="phone-keypad-suggestion__avatar">
|
||||
<img
|
||||
v-if="contact.avatar_url || contact.icon"
|
||||
:src="contact.avatar_url ?? contact.icon"
|
||||
v-if="contact.avatar_url"
|
||||
:src="contact.avatar_url"
|
||||
alt=""
|
||||
/>
|
||||
<template v-else>{{
|
||||
|
||||
Reference in New Issue
Block a user