Skip to content

Commit

Permalink
Merge branch 'stable2.2' into backport/8611/stable2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
GretaD authored Sep 25, 2023
2 parents 66545c4 + cdc9fa9 commit 56dcc09
Show file tree
Hide file tree
Showing 8 changed files with 136 additions and 109 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ jobs:
name: php${{ matrix.php-versions }}-${{ matrix.db }} integration tests
services:
mail-service:
image: christophwurst/imap-devel
image: ghcr.io/christophwurst/docker-imap-devel:latest
env:
MAILNAME: mail.domain.tld
MAIL_ADDRESS: [email protected]
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"youthweb/urllinker": "^1.3"
},
"require-dev": {
"christophwurst/nextcloud": "^21.0.0",
"nextcloud/ocp": "^21.0.0",
"psalm/phar": "^4.6",
"roave/security-advisories": "dev-master"
},
Expand Down
13 changes: 8 additions & 5 deletions composer.lock

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

7 changes: 7 additions & 0 deletions lib/Controller/AutoConfigController.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
use OCA\Mail\Validation\RemoteHostValidator;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\Attribute\UserRateLimit;
use OCP\IRequest;
use function in_array;

Expand All @@ -60,9 +61,11 @@ public function __construct(IRequest $request,
*
* @NoAdminRequired
* @TrapError
* @UserRateThrottle(limit: 5, period: 60)
*
* @return JsonResponse
*/
#[UserRateLimit(limit: 5, period: 60)]
public function queryIspdb(string $email): JsonResponse {
$rfc822Address = new Horde_Mail_Rfc822_Address($email);
if (!$rfc822Address->valid || !$this->hostValidator->isValid($rfc822Address->host)) {
Expand All @@ -78,9 +81,11 @@ public function queryIspdb(string $email): JsonResponse {
*
* @NoAdminRequired
* @TrapError
* @UserRateThrottle(limit: 5, period: 60)
*
* @return JsonResponse
*/
#[UserRateLimit(limit: 5, period: 60)]
public function queryMx(string $email): JsonResponse {
$rfc822Address = new Horde_Mail_Rfc822_Address($email);
if (!$rfc822Address->valid || !$this->hostValidator->isValid($rfc822Address->host)) {
Expand All @@ -98,9 +103,11 @@ public function queryMx(string $email): JsonResponse {
*
* @NoAdminRequired
* @TrapError
* @UserRateThrottle(limit: 10, period: 60)
*
* @return JsonResponse
*/
#[UserRateLimit(limit: 10, period: 60)]
public function testConnectivity(string $host, int $port): JsonResponse {
if (!in_array($port, [143, 993, 465, 587])) {
return JsonResponse::fail('Port not allowed');
Expand Down
31 changes: 19 additions & 12 deletions lib/Service/ContactsIntegration.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function getMatchingRecipient(string $userId, string $term): array {
$shareeEnumerationFullMatchUserId = $shareeEnumerationFullMatch && $this->config->getAppValue('core', 'shareapi_restrict_user_enumeration_full_match_userid', 'yes') === 'yes';
$shareeEnumerationFullMatchEmail = $shareeEnumerationFullMatch && $this->config->getAppValue('core', 'shareapi_restrict_user_enumeration_full_match_email', 'yes') === 'yes';

$result = $this->contactsManager->search($term, ['UID', 'FN', 'EMAIL'], ['enumeration' => $shareeEnumeration]);
$result = $this->contactsManager->search($term, ['UID', 'FN', 'EMAIL'], ['enumeration' => $shareeEnumeration, 'fullmatch' => $shareeEnumerationFullMatch]);
if (empty($result)) {
return [];
}
Expand Down Expand Up @@ -118,18 +118,25 @@ public function getMatchingRecipient(string $userId, string $term): array {
continue;
}
$lowerTerm = strtolower($term);
if (!$isSystemUser || $isInSameGroup || ($lowerTerm !== '' && (
($shareeEnumerationFullMatch && !empty($fn) && $lowerTerm === strtolower($fn)) ||
($shareeEnumerationFullMatchUserId && $lowerTerm === strtolower($id)) ||
($shareeEnumerationFullMatchEmail && $lowerTerm === strtolower($e))))) {
$receivers[] = [
'id' => $id,
// Show full name if possible or fall back to email
'label' => (empty($fn) ? $e : "$fn ($e)"),
'email' => $e,
'photo' => $photo,
];

if ($isSystemUser && $shareeEnumerationInGroupOnly && !$isInSameGroup) {
// Check for full match. If full match is disabled, matching results already filtered out
if (!($lowerTerm !== '' && (
($shareeEnumerationFullMatch && !empty($fn) && $lowerTerm === strtolower($fn)) ||
($shareeEnumerationFullMatchUserId && $lowerTerm === strtolower($id)) ||
($shareeEnumerationFullMatchEmail && $lowerTerm === strtolower($e))))) {
// Not a full Match
continue;
}
}

$receivers[] = [
'id' => $id,
// Show full name if possible or fall back to email
'label' => (empty($fn) ? $e : "$fn ($e)"),
'email' => $e,
'photo' => $photo,
];
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/components/AccountForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,8 @@ export default {
this.feedback = t('mail', 'SMTP connection failed')
} else if (error.message === CONSENT_ABORTED) {
this.feedback = t('mail', 'Google authorization popup closed')
} else if (error.response?.status === 429) {
this.feedback = t('mail', 'Configuration discovery temporarily not available. Please try again later.')
} else {
this.feedback = t('mail', 'There was an error while setting up your account')
}
Expand Down
9 changes: 5 additions & 4 deletions src/components/RecipientBubble.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
:display-name="label"
:avatar-image="avatarUrlAbsolute"
@click="onClickOpenContactDialog">
<span class="user-bubble-email">{{ email }}</span>
</UserBubble>
<div class="contact-wrapper">
<p class="contact-popover__email">{{ email }}</p>
<ButtonVue v-if="contactsWithEmail && contactsWithEmail.length > 0" type="tertiary-no-background" class="contact-existing">
<template #icon>
<IconDetails :size="20" />
Expand Down Expand Up @@ -254,16 +254,17 @@ export default {
.user-bubble__title {
max-width: 30vw;
}
.user-bubble-email {
margin: 10px;
}
.contact-menu {
display: flex;
flex-wrap: wrap;
}
.contact-popover {
display: inline-block;
&__email {
text-align: center;
}
}
.contact-wrapper {
padding:10px;
Expand Down
Loading

0 comments on commit 56dcc09

Please sign in to comment.