Skip to content

Commit

Permalink
Merge branch 'main' into enh/add-occ-debug-command
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastianKrupinski authored Nov 11, 2024
2 parents 2c0f6fe + 72ff480 commit 131fcea
Show file tree
Hide file tree
Showing 11 changed files with 64 additions and 57 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
name: Build release tarball
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Read package.json node and npm engines version
uses: skjnldsv/read-package-engines-version-actions@8205673bab74a63eb9b8093402fd9e0e018663a1 # v2.2
id: versions
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
node-version: 'false'
install: true
- name: Checkout Mail
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
path: nextcloud/apps/mail
fetch-depth: 2
Expand Down Expand Up @@ -145,7 +145,7 @@ jobs:
php -f nextcloud/occ config:system:set memcache.local --value='\OC\Memcache\Redis'
php -f nextcloud/occ config:system:set memcache.distributed --value='\OC\Memcache\Redis'
- name: Checkout Mail
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
path: nextcloud/apps/mail
fetch-depth: 2
Expand Down Expand Up @@ -199,7 +199,7 @@ jobs:
runs-on: ubuntu-latest
name: Front-end unit tests
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Read package.json node and npm engines version
uses: skjnldsv/read-package-engines-version-actions@8205673bab74a63eb9b8093402fd9e0e018663a1 # v2.2
id: versions
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-public-suffix-list.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
name: update-public-suffix-list-${{ matrix.branches }}

steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
- uses: actions/checkout@3b9b8c884f6b4bb4d5be2779c26374abadae0871
with:
ref: ${{ matrix.branches }}
submodules: true
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
"arthurhoaro/favicon": "^2.0.1",
"bamarni/composer-bin-plugin": "^1.8.2",
"bytestream/horde-exception": "^2.2.0",
"bytestream/horde-imap-client": "^2.33.2",
"bytestream/horde-imap-client": "^2.33.3",
"bytestream/horde-mail": "^2.7.1",
"bytestream/horde-mime": "^2.13.2",
"bytestream/horde-stream": "^1.7.1",
"bytestream/horde-stream": "^1.7.2",
"bytestream/horde-stringprep": "^1.2.1",
"bytestream/horde-support": "^2.4.0",
"bytestream/horde-text-filter": "^2.5.0",
Expand Down
26 changes: 13 additions & 13 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions l10n/ar.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ OC.L10N.register(
"Mails" : "رسائل",
"Sender email: %1$s is not in the address book, but the sender name: %2$s is in the address book with the following email: %3$s" : "مُرسِل الإيميل: %1$s ليس في دفتر العناوين؛ لكن اسم المُرسِل: %2$s مُسجّلٌ في دفتر العناوين مع الإيميل التالي: %3$s",
"Sender email: %1$s is not in the address book, but the sender name: %2$s is in the address book with the following emails: %3$s" : "عنوان إيميل المُرسِل: %1$s ليس في دفتر العناوين؛ لكن اسم المُرسِل: %2$s موجود مرتبطاً بعناوين الإيميل التالية : %3$s",
"Sender is using a custom email: %1$s instead of the sender email: %2$s" : "يستعمل المُرسل عنواناً مُخصّصاً للإيميل: %1$s بدلاً عن عنوان إيميل المرسل: %2$s",
"Sent date is in the future" : "تاريخ الإرسال في المستقبل و لم يحِن بعدُ",
"Sender is using a custom email: %1$s instead of the sender email: %2$s" : "يستعمل المرسل عنوان مخصص للبريد الإلكتروني: %1$s بدلاً عن عنوان بريد المرسل: %2$s",
"Sent date is in the future" : "تاريخ الإرسال في المستقبل و لم يحن بعدُ",
"Some addresses in this message are not matching the link text" : "بعض العناوين في هذا الإيميل لا تتطابق مع نص الرابط",
"Reply-To email: %1$s is different from the sender email: %2$s" : "عنوان الإيميل المردود عليه: %1$s يختلف عن عنوان إيميل المُرسِل: %2$s",
"💌 A mail app for Nextcloud" : "💌 تطبيق البريد الالكتروني Mail لنكست كلود",
Expand Down Expand Up @@ -204,7 +204,7 @@ OC.L10N.register(
"Tomorrow morning" : "غداً صباحاً",
"Tomorrow afternoon" : "غداً ظُهراً",
"Monday morning" : "أول صباح عمل في الأسبوع",
"Custom date and time" : "وقت و تاريخ مُخصّص",
"Custom date and time" : "وقت وتاريخ مخصص",
"Enter a date" : "أدخِل تاريخاً",
"Encrypt with S/MIME and send later" : "شفّر مع S/MIME و أرسِل لاحقاً",
"Encrypt with S/MIME and send" : "شفّر مع S/MIME و أرسِل ",
Expand Down Expand Up @@ -485,7 +485,7 @@ OC.L10N.register(
"Sieve Port" : "منفذ تطبيق \"الغربال\" Sieve",
"Sieve credentials" : "متطلبات تسجيل الدخول لـ \"الغِربال\"",
"IMAP credentials" : "حيثيات IMAP",
"Custom" : "مُخصّص",
"Custom" : "مخصص",
"Sieve User" : "مُستخدِم تطبيق \"الغربال\" Sieve",
"Sieve Password" : "تطبيق Sieve Password",
"Oh snap!" : "ياللمفاجأة!",
Expand Down Expand Up @@ -687,7 +687,7 @@ OC.L10N.register(
"E-mail address" : "عنوان البريد الالكتروني",
"Valid until" : "صالحٌ حتّى",
"Delete certificate" : "حذف الشهادة",
"No certificate imported yet" : "لم يتمّ استيراد أي شهادةٍ بعدُ",
"No certificate imported yet" : "لم يتمّ استيراد أي شهادةٍ حتى الآن",
"Import certificate" : "إستيراد شهادة",
"Import S/MIME certificate" : "إستيراد شهادة S/MIME ",
"PKCS #12 Certificate" : "شهادة PKCS ـ #12 ",
Expand Down
10 changes: 5 additions & 5 deletions l10n/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"Mails" : "رسائل",
"Sender email: %1$s is not in the address book, but the sender name: %2$s is in the address book with the following email: %3$s" : "مُرسِل الإيميل: %1$s ليس في دفتر العناوين؛ لكن اسم المُرسِل: %2$s مُسجّلٌ في دفتر العناوين مع الإيميل التالي: %3$s",
"Sender email: %1$s is not in the address book, but the sender name: %2$s is in the address book with the following emails: %3$s" : "عنوان إيميل المُرسِل: %1$s ليس في دفتر العناوين؛ لكن اسم المُرسِل: %2$s موجود مرتبطاً بعناوين الإيميل التالية : %3$s",
"Sender is using a custom email: %1$s instead of the sender email: %2$s" : "يستعمل المُرسل عنواناً مُخصّصاً للإيميل: %1$s بدلاً عن عنوان إيميل المرسل: %2$s",
"Sent date is in the future" : "تاريخ الإرسال في المستقبل و لم يحِن بعدُ",
"Sender is using a custom email: %1$s instead of the sender email: %2$s" : "يستعمل المرسل عنوان مخصص للبريد الإلكتروني: %1$s بدلاً عن عنوان بريد المرسل: %2$s",
"Sent date is in the future" : "تاريخ الإرسال في المستقبل و لم يحن بعدُ",
"Some addresses in this message are not matching the link text" : "بعض العناوين في هذا الإيميل لا تتطابق مع نص الرابط",
"Reply-To email: %1$s is different from the sender email: %2$s" : "عنوان الإيميل المردود عليه: %1$s يختلف عن عنوان إيميل المُرسِل: %2$s",
"💌 A mail app for Nextcloud" : "💌 تطبيق البريد الالكتروني Mail لنكست كلود",
Expand Down Expand Up @@ -202,7 +202,7 @@
"Tomorrow morning" : "غداً صباحاً",
"Tomorrow afternoon" : "غداً ظُهراً",
"Monday morning" : "أول صباح عمل في الأسبوع",
"Custom date and time" : "وقت و تاريخ مُخصّص",
"Custom date and time" : "وقت وتاريخ مخصص",
"Enter a date" : "أدخِل تاريخاً",
"Encrypt with S/MIME and send later" : "شفّر مع S/MIME و أرسِل لاحقاً",
"Encrypt with S/MIME and send" : "شفّر مع S/MIME و أرسِل ",
Expand Down Expand Up @@ -483,7 +483,7 @@
"Sieve Port" : "منفذ تطبيق \"الغربال\" Sieve",
"Sieve credentials" : "متطلبات تسجيل الدخول لـ \"الغِربال\"",
"IMAP credentials" : "حيثيات IMAP",
"Custom" : "مُخصّص",
"Custom" : "مخصص",
"Sieve User" : "مُستخدِم تطبيق \"الغربال\" Sieve",
"Sieve Password" : "تطبيق Sieve Password",
"Oh snap!" : "ياللمفاجأة!",
Expand Down Expand Up @@ -685,7 +685,7 @@
"E-mail address" : "عنوان البريد الالكتروني",
"Valid until" : "صالحٌ حتّى",
"Delete certificate" : "حذف الشهادة",
"No certificate imported yet" : "لم يتمّ استيراد أي شهادةٍ بعدُ",
"No certificate imported yet" : "لم يتمّ استيراد أي شهادةٍ حتى الآن",
"Import certificate" : "إستيراد شهادة",
"Import S/MIME certificate" : "إستيراد شهادة S/MIME ",
"PKCS #12 Certificate" : "شهادة PKCS ـ #12 ",
Expand Down
1 change: 1 addition & 0 deletions lib/Dashboard/MailWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ public function getItems(string $userId, ?string $since = null, int $limit = 7):
$intSince = $since === null ? null : (int)$since;
$emails = $this->getEmails($userId, $intSince, $limit);

/** @var list<WidgetItem> */
return array_map(function (Message $email) {
$firstFrom = $email->getFrom()->first();
return new WidgetItem(
Expand Down
21 changes: 15 additions & 6 deletions lib/Service/IMipService.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ public function process(): void {
continue;
}

$principalUri = 'principals/users/' . $account->getUserId();
$recipient = $account->getEmail();

foreach ($filteredMessages as $message) {
/** @var IMAPMessage $imapMessage */
$imapMessage = current(array_filter($imapMessages, static function (IMAPMessage $imapMessage) use ($message) {
Expand All @@ -131,17 +134,23 @@ public function process(): void {
continue;
}

$principalUri = 'principals/users/' . $account->getUserId();
$sender = $imapMessage->getFrom()->first()->getEmail();
$recipient = $account->getEmail();
$sender = $imapMessage->getFrom()->first()?->getEmail();
if ($sender === null) {
$message->setImipError(true);
continue;
}

foreach ($imapMessage->scheduling as $schedulingInfo) { // an IMAP message could contain more than one iMIP object
if ($schedulingInfo['method'] === 'REPLY') {
if ($schedulingInfo['method'] === 'REQUEST' && method_exists($this->calendarManager, 'handleIMipRequest')) {
$processed = $this->calendarManager->handleIMipRequest($principalUri, $sender, $recipient, $schedulingInfo['contents']);
$message->setImipProcessed($processed);
$message->setImipError(!$processed);
} elseif ($schedulingInfo['method'] === 'REPLY') {
$processed = $this->calendarManager->handleIMipReply($principalUri, $sender, $recipient, $schedulingInfo['contents']);
$message->setImipProcessed($processed);
$message->setImipError(!$processed);
} elseif ($schedulingInfo['method'] === 'CANCEL') {
$replyTo = $imapMessage->getReplyTo()->first();
$replyTo = !empty($replyTo) ? $replyTo->getEmail() : null;
$replyTo = $imapMessage->getReplyTo()->first()?->getEmail();
$processed = $this->calendarManager->handleIMipCancel($principalUri, $sender, $replyTo, $recipient, $schedulingInfo['contents']);
$message->setImipProcessed($processed);
$message->setImipError(!$processed);
Expand Down
6 changes: 1 addition & 5 deletions src/components/TextEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -292,11 +292,7 @@ export default {
try {
logger.debug(`loading ${language} translations for CKEditor`)
await import(
/* webpackMode: "lazy-once" */
/* webpackPrefetch: true */
/* webpackPreload: true */
`@ckeditor/ckeditor5-build-decoupled-document/build/translations/${language}`
)
`../../node_modules/@ckeditor/ckeditor5-build-decoupled-document/build/translations/${language}.js`)
this.showEditor(language)
} catch (error) {
logger.error(`could not find CKEditor translations for "${language}"`, { error })
Expand Down
33 changes: 17 additions & 16 deletions tests/Unit/Service/IMipServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,6 @@ class IMipServiceTest extends TestCase {
protected function setUp(): void {
parent::setUp();

// iMIP is NC25+
if (!method_exists(IManager::class, 'handleImipReply')) {
self::markTestIncomplete();
}


$this->accountService = $this->createMock(AccountService::class);
$this->calendarManager = $this->createMock(IManager::class);
$this->mailboxMapper = $this->createMock(MailboxMapper::class);
Expand Down Expand Up @@ -242,6 +236,12 @@ public function testImapConnectionServiceException(): void {
}

public function testIsRequest(): void {

// iMip Request is NC31+
if (!method_exists(IManager::class, 'handleImipRequest')) {
self::markTestIncomplete();
}

$message = new Message();
$message->setImipMessage(true);
$message->setUid(1);
Expand All @@ -252,9 +252,10 @@ public function testIsRequest(): void {
$mailAccount = new MailAccount();
$mailAccount->setId(200);
$mailAccount->setEmail('vincent@stardew-valley.edu');
$mailAccount->setUserId('vincent');
$account = new Account($mailAccount);
$imapMessage = $this->createMock(IMAPMessage::class);
$imapMessage->scheduling[] = ['method' => 'REQUEST'];
$imapMessage->scheduling[] = ['method' => 'REQUEST', 'contents' => 'VCALENDAR'];
$addressList = $this->createMock(AddressList::class);
$address = $this->createMock(Address::class);

Expand Down Expand Up @@ -282,15 +283,17 @@ public function testIsRequest(): void {
->willReturn($address);
$address->expects(self::once())
->method('getEmail')
->willReturn('pam@stardew-bus-company.com');
->willReturn('pam@stardew-bus-service.com');
$this->logger->expects(self::never())
->method('info');
$this->calendarManager->expects(self::never())
->method('handleIMipReply');
$this->calendarManager->expects(self::never())
->method('handleIMipCancel');
$this->messageMapper->expects(self::never())
->method('updateBulk');
$this->calendarManager->expects(self::once())
->method('handleIMipRequest')
->with('principals/users/vincent',
'pam@stardew-bus-service.com',
$account->getEmail(),
$imapMessage->scheduling[0]['contents']);
$this->messageMapper->expects(self::once())
->method('updateImipData');

$this->service->process();
}
Expand Down Expand Up @@ -349,8 +352,6 @@ public function testIsReply(): void {
'pam@stardew-bus-service.com',
$account->getEmail(),
$imapMessage->scheduling[0]['contents']);
$this->calendarManager->expects(self::never())
->method('handleIMipCancel');
$this->messageMapper->expects(self::once())
->method('updateImipData');

Expand Down

0 comments on commit 131fcea

Please sign in to comment.