Page MenuHomePhabricator

D13125.id.diff
No OneTemporary

D13125.id.diff

diff --git a/src/applications/settings/panel/PhabricatorEmailAddressesSettingsPanel.php b/src/applications/settings/panel/PhabricatorEmailAddressesSettingsPanel.php
--- a/src/applications/settings/panel/PhabricatorEmailAddressesSettingsPanel.php
+++ b/src/applications/settings/panel/PhabricatorEmailAddressesSettingsPanel.php
@@ -15,8 +15,16 @@
return pht('Email');
}
+ public function isEditableByAdministrators() {
+ if ($this->getUser()->getIsMailingList()) {
+ return true;
+ }
+
+ return false;
+ }
+
public function processRequest(AphrontRequest $request) {
- $user = $request->getUser();
+ $user = $this->getUser();
$editable = PhabricatorEnv::getEnvConfig('account.editable');
$uri = $request->getRequestURI();
@@ -157,7 +165,8 @@
PhutilURI $uri,
$new) {
- $user = $request->getUser();
+ $user = $this->getUser();
+ $viewer = $this->getViewer();
$e_email = true;
$email = null;
@@ -171,7 +180,7 @@
}
PhabricatorSystemActionEngine::willTakeAction(
- array($user->getPHID()),
+ array($viewer->getPHID()),
new PhabricatorSettingsAddEmailAction(),
1);
@@ -201,12 +210,24 @@
->setAddress($email)
->setIsVerified(0);
- try {
+ // If an administrator is editing a mailing list, automatically verify
+ // the address.
+ if ($viewer->getPHID() != $user->getPHID()) {
+ if ($viewer->getIsAdmin()) {
+ $object->setIsVerified(1);
+ }
+ }
+ try {
id(new PhabricatorUserEditor())
- ->setActor($user)
+ ->setActor($viewer)
->addEmail($user, $object);
+ if ($object->getIsVerified()) {
+ // If we autoverified the address, just reload the page.
+ return id(new AphrontReloadResponse())->setURI($uri);
+ }
+
$object->sendVerificationEmail($user);
$dialog = id(new AphrontDialogView())
@@ -242,7 +263,7 @@
->setError($e_email));
$dialog = id(new AphrontDialogView())
- ->setUser($user)
+ ->setUser($viewer)
->addHiddenInput('new', 'true')
->setTitle(pht('New Address'))
->appendChild($errors)
@@ -257,8 +278,8 @@
AphrontRequest $request,
PhutilURI $uri,
$email_id) {
-
- $user = $request->getUser();
+ $user = $this->getUser();
+ $viewer = $this->getViewer();
// NOTE: You can only delete your own email addresses, and you can not
// delete your primary address.
@@ -272,9 +293,8 @@
}
if ($request->isFormPost()) {
-
id(new PhabricatorUserEditor())
- ->setActor($user)
+ ->setActor($viewer)
->removeEmail($user, $email);
return id(new AphrontRedirectResponse())->setURI($uri);
@@ -283,7 +303,7 @@
$address = $email->getAddress();
$dialog = id(new AphrontDialogView())
- ->setUser($user)
+ ->setUser($viewer)
->addHiddenInput('delete', $email_id)
->setTitle(pht("Really delete address '%s'?", $address))
->appendParagraph(
@@ -304,8 +324,8 @@
AphrontRequest $request,
PhutilURI $uri,
$email_id) {
-
- $user = $request->getUser();
+ $user = $this->getUser();
+ $viewer = $this->getViewer();
// NOTE: You can only send more email for your unverified addresses.
$email = id(new PhabricatorUserEmail())->loadOneWhere(
@@ -325,7 +345,7 @@
$address = $email->getAddress();
$dialog = id(new AphrontDialogView())
- ->setUser($user)
+ ->setUser($viewer)
->addHiddenInput('verify', $email_id)
->setTitle(pht('Send Another Verification Email?'))
->appendChild(phutil_tag('p', array(), pht(
@@ -341,11 +361,11 @@
AphrontRequest $request,
PhutilURI $uri,
$email_id) {
-
- $user = $request->getUser();
+ $user = $this->getUser();
+ $viewer = $this->getViewer();
$token = id(new PhabricatorAuthSessionEngine())->requireHighSecuritySession(
- $user,
+ $viewer,
$request,
$this->getPanelURI());
@@ -360,9 +380,8 @@
}
if ($request->isFormPost()) {
-
id(new PhabricatorUserEditor())
- ->setActor($user)
+ ->setActor($viewer)
->changePrimaryEmail($user, $email);
return id(new AphrontRedirectResponse())->setURI($uri);
@@ -371,7 +390,7 @@
$address = $email->getAddress();
$dialog = id(new AphrontDialogView())
- ->setUser($user)
+ ->setUser($viewer)
->addHiddenInput('primary', $email_id)
->setTitle(pht('Change primary email address?'))
->appendParagraph(

File Metadata

Mime Type
text/plain
Expires
Jun 10 2024, 9:45 PM (5 w, 1 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6277541
Default Alt Text
D13125.id.diff (4 KB)

Event Timeline