mirror of
https://github.com/nextcloud/server.git
synced 2026-04-22 14:50:17 -04:00
Merge pull request #58862 from nextcloud/fix/add-note-example-contact
fix:(dav): add note to example contact
This commit is contained in:
commit
f0f38fd04c
2 changed files with 9 additions and 0 deletions
|
|
@ -15,6 +15,7 @@ use OCP\AppFramework\Services\IAppConfig;
|
|||
use OCP\Files\AppData\IAppDataFactory;
|
||||
use OCP\Files\IAppData;
|
||||
use OCP\Files\NotFoundException;
|
||||
use OCP\IL10N;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\Uid\Uuid;
|
||||
|
||||
|
|
@ -26,6 +27,7 @@ class ExampleContactService {
|
|||
private readonly IAppConfig $appConfig,
|
||||
private readonly LoggerInterface $logger,
|
||||
private readonly CardDavBackend $cardDav,
|
||||
private readonly IL10N $l,
|
||||
) {
|
||||
$this->appData = $appDataFactory->get(Application::APP_ID);
|
||||
}
|
||||
|
|
@ -131,6 +133,9 @@ class ExampleContactService {
|
|||
} else {
|
||||
$vcard->add('REV', $newRev);
|
||||
}
|
||||
if (!$vcard->Note) {
|
||||
$vcard->add('note', $this->l->t('This is an example contact'));
|
||||
}
|
||||
|
||||
// Level 3 means that the document is invalid
|
||||
// https://sabre.io/vobject/vcard/#validating-vcard
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ use OCP\Files\IAppData;
|
|||
use OCP\Files\NotFoundException;
|
||||
use OCP\Files\SimpleFS\ISimpleFile;
|
||||
use OCP\Files\SimpleFS\ISimpleFolder;
|
||||
use OCP\IL10N;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\Uid\Uuid;
|
||||
|
|
@ -31,6 +32,7 @@ class ExampleContactServiceTest extends TestCase {
|
|||
protected LoggerInterface&MockObject $logger;
|
||||
protected IAppConfig&MockObject $appConfig;
|
||||
protected IAppData&MockObject $appData;
|
||||
protected IL10N&MockObject $l;
|
||||
|
||||
protected function setUp(): void {
|
||||
parent::setUp();
|
||||
|
|
@ -39,6 +41,7 @@ class ExampleContactServiceTest extends TestCase {
|
|||
$this->appDataFactory = $this->createMock(IAppDataFactory::class);
|
||||
$this->logger = $this->createMock(LoggerInterface::class);
|
||||
$this->appConfig = $this->createMock(IAppConfig::class);
|
||||
$this->l = $this->createMock((IL10N::class));
|
||||
|
||||
$this->appData = $this->createMock(IAppData::class);
|
||||
$this->appDataFactory->method('get')
|
||||
|
|
@ -50,6 +53,7 @@ class ExampleContactServiceTest extends TestCase {
|
|||
$this->appConfig,
|
||||
$this->logger,
|
||||
$this->cardDav,
|
||||
$this->l,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue