Skip to content

Commit

Permalink
Fix emailing multiple site maintainers (#2520)
Browse files Browse the repository at this point in the history
Prior to this commit, attempting to email multiple site maintainers from
the manageProjectRoles.php page would result in the following error:

```
Email "[email protected], [email protected]" does not comply with addr-spec of RFC 2822.
```

Fixes #2450
Follow-up to #2505
  • Loading branch information
zackgalbreath authored Oct 29, 2024
1 parent 823b6ca commit 1df0efb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
11 changes: 4 additions & 7 deletions app/Http/Controllers/ManageProjectRolesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,18 +77,15 @@ public function viewPage(): View|RedirectResponse
if (strlen($emailMaintainers) < 50) {
$xml .= '<error>The email should be more than 50 characters.</error>';
} else {
$email_to = [];
$maintainerids = self::find_site_maintainers(intval($projectid));
$email = '';
foreach ($maintainerids as $maintainerid) {
if (strlen($email) > 0) {
$email .= ', ';
}
$email .= User::findOrFail((int) $maintainerid)->email;
$email_to[] = User::findOrFail((int) $maintainerid)->email;
}

$projectname = get_project_name($projectid);
if ($email != '') {
if (cdashmail("$email", 'CDash - ' . $projectname . ' : To Site Maintainers', "$emailMaintainers")) {
if (count($email_to) !== 0) {
if (cdashmail($email_to, 'CDash - ' . $projectname . ' : To Site Maintainers', "$emailMaintainers")) {
$xml .= '<warning>Email sent to site maintainers.</warning>';
} else {
$xml .= '<error>Cannot send email to site maintainers.</error>';
Expand Down
2 changes: 1 addition & 1 deletion phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -1417,7 +1417,7 @@ parameters:

-
message: "#^Loose comparison via \"\\!\\=\" is not allowed\\.$#"
count: 5
count: 4
path: app/Http/Controllers/ManageProjectRolesController.php

-
Expand Down

0 comments on commit 1df0efb

Please sign in to comment.