Fix FLEXIAPI-140 Select the display_name attribute from the database to inject...

This commit is contained in:
Timothée Jaussoin 2024-02-22 10:50:33 +00:00
parent 248fce60fe
commit 07f8a6e7dd
4 changed files with 7 additions and 5 deletions

View file

@ -473,8 +473,8 @@ IMPP:sip:' . $this->getIdentifierAttribute();
$vcard .= '
FN:';
$vcard .= !empty($this->attributes['display_name'])
? $this->attributes['display_name']
$vcard .= !empty($this->display_name)
? $this->display_name
: $this->getIdentifierAttribute();
if ($this->dtmf_protocol) {

View file

@ -120,7 +120,7 @@ function captchaConfigured(): bool
function resolveUserContacts(Request $request)
{
$selected = ['id', 'username', 'domain', 'activated', 'dtmf_protocol'];
$selected = ['id', 'username', 'domain', 'activated', 'dtmf_protocol', 'display_name'];
return Account::whereIn('id', function ($query) use ($request) {
$query->select('contact_id')

View file

@ -35,7 +35,7 @@ class AccountFactory extends Factory
{
return [
'username' => $this->faker->username,
'display_name' => $this->faker->username,
'display_name' => $this->faker->name,
'domain' => config('app.sip_domain'),
'email' => $this->faker->email,
'user_agent' => $this->faker->userAgent,

View file

@ -99,6 +99,8 @@ class AccountProvisioningTest extends TestCase
public function testAuthenticatedReProvisioning()
{
$password = Password::factory()->create();
$password->account->display_name = "Anna O'Reily";
$password->account->save();
$password->account->generateApiKey();
$provisioningToken = $password->account->provisioning_token;
@ -123,7 +125,7 @@ class AccountProvisioningTest extends TestCase
->assertStatus(200)
->assertHeader('Content-Type', 'application/xml')
->assertSee($password->account->username)
->assertSee($password->account->display_name)
->assertSee($password->account->display_name, false)
->assertSee('ha1');
}