-
Notifications
You must be signed in to change notification settings - Fork 440
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13871 from nextcloud/feat/13451/import-email-list
feat(invitations): Allow importing CSV email lists
- Loading branch information
Showing
11 changed files
with
893 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
/** | ||
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors | ||
* SPDX-License-Identifier: AGPL-3.0-or-later | ||
*/ | ||
|
||
|
||
namespace OCA\Talk\Exceptions; | ||
|
||
class GuestImportException extends \Exception { | ||
public const REASON_ROOM = 'room'; | ||
public const REASON_ROWS = 'rows'; | ||
public const REASON_HEADER_EMAIL = 'header-email'; | ||
public const REASON_HEADER_NAME = 'header-name'; | ||
|
||
/** | ||
* @param self::REASON_* $reason | ||
* @param list<non-negative-int>|null $invalidLines | ||
* @param non-negative-int|null $invites | ||
* @param non-negative-int|null $duplicates | ||
*/ | ||
public function __construct( | ||
protected readonly string $reason, | ||
protected readonly ?string $errorMessage = null, | ||
protected readonly ?array $invalidLines = null, | ||
protected readonly ?int $invites = null, | ||
protected readonly ?int $duplicates = null, | ||
) { | ||
parent::__construct(); | ||
} | ||
|
||
/** | ||
* @return self::REASON_* | ||
*/ | ||
public function getReason(): string { | ||
return $this->reason; | ||
} | ||
|
||
public function getErrorMessage(): ?string { | ||
return $this->errorMessage; | ||
} | ||
|
||
/** | ||
* @return non-negative-int|null | ||
*/ | ||
public function getInvites(): ?int { | ||
return $this->invites; | ||
} | ||
|
||
/** | ||
* @return non-negative-int|null | ||
*/ | ||
public function getDuplicates(): ?int { | ||
return $this->duplicates; | ||
} | ||
|
||
/** | ||
* @return non-negative-int|null | ||
*/ | ||
public function getInvalid(): ?int { | ||
return $this->invalidLines === null ? null : count($this->invalidLines); | ||
} | ||
|
||
/** | ||
* @return list<non-negative-int>|null | ||
*/ | ||
public function getInvalidLines(): ?array { | ||
return $this->invalidLines; | ||
} | ||
|
||
public function getData(): array { | ||
$data = ['error' => $this->errorMessage]; | ||
if ($this->errorMessage !== null) { | ||
$data['message'] = $this->errorMessage; | ||
} | ||
if ($this->invites !== null) { | ||
$data['invites'] = $this->invites; | ||
} | ||
if ($this->duplicates !== null) { | ||
$data['duplicates'] = $this->duplicates; | ||
} | ||
if ($this->invalidLines !== null) { | ||
$data['invalid'] = count($this->invalidLines); | ||
$data['invalidLines'] = $this->invalidLines; | ||
} | ||
|
||
return $data; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.