@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Expand the "PhabricatorExternalAccount" table for new registration

Summary:
Ref T1536. This is the schema code for `PhabricatorExternalAccount` which was previously in D4647. I'm splitting it out so I can put it earlier in the sequence and because it's simple and standalone.

Expands `PhabricatorExternalAccount` to have everything we need for the rest of registration.

Test Plan: Implemented the remainder of new registration on top of this.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T1536

Differential Revision: https://secure.phabricator.com/D6169

+63 -1
+31
resources/sql/patches/20130607.xaccount.sql
··· 1 + TRUNCATE {$NAMESPACE}_user.user_externalaccount; 2 + 3 + ALTER TABLE {$NAMESPACE}_user.user_externalaccount 4 + CHANGE accountDomain accountDomain varchar(64) NOT NULL COLLATE utf8_bin; 5 + 6 + ALTER TABLE {$NAMESPACE}_user.user_externalaccount 7 + CHANGE displayName displayName varchar(255) COLLATE utf8_bin; 8 + 9 + ALTER TABLE {$NAMESPACE}_user.user_externalaccount 10 + ADD username VARCHAR(255) COLLATE utf8_bin; 11 + 12 + ALTER TABLE {$NAMESPACE}_user.user_externalaccount 13 + ADD realName VARCHAR(255) COLLATE utf8_bin; 14 + 15 + ALTER TABLE {$NAMESPACE}_user.user_externalaccount 16 + ADD email VARCHAR(255) COLLATE utf8_bin; 17 + 18 + ALTER TABLE {$NAMESPACE}_user.user_externalaccount 19 + ADD emailVerified BOOL NOT NULL COLLATE utf8_bin; 20 + 21 + ALTER TABLE {$NAMESPACE}_user.user_externalaccount 22 + ADD accountURI VARCHAR(255) COLLATE utf8_bin; 23 + 24 + ALTER TABLE {$NAMESPACE}_user.user_externalaccount 25 + ADD profileImagePHID VARCHAR(64) COLLATE utf8_bin; 26 + 27 + ALTER TABLE {$NAMESPACE}_user.user_externalaccount 28 + ADD properties LONGTEXT NOT NULL COLLATE utf8_bin; 29 + 30 + ALTER TABLE {$NAMESPACE}_user.user_externalaccount 31 + ADD KEY `key_userAccounts` (userPHID);
+4 -1
src/applications/metamta/receiver/PhabricatorMailReceiver.php
··· 84 84 $allow_email_users = PhabricatorEnv::getEnvConfig($email_key); 85 85 if ($allow_email_users) { 86 86 $xuser = id(new PhabricatorExternalAccount())->loadOneWhere( 87 - 'accountType = %s AND accountDomain IS NULL and accountID = %s', 87 + 'accountType = %s AND accountDomain = %s and accountID = %s', 88 88 'email', 89 + 'self', 89 90 $from); 90 91 if (!$xuser) { 91 92 $xuser = id(new PhabricatorExternalAccount()) 92 93 ->setAccountID($from) 93 94 ->setAccountType('email') 95 + ->setAccountDomain('self') 94 96 ->setDisplayName($from) 97 + ->setEmail($from) 95 98 ->save(); 96 99 } 97 100 return $xuser->getPhabricatorUser();
+7
src/applications/people/editor/PhabricatorUserEditor.php
··· 317 317 $oauth->delete(); 318 318 } 319 319 320 + $externals = id(new PhabricatorExternalAccount())->loadAllWhere( 321 + 'userPHID = %s', 322 + $user->getPHID()); 323 + foreach ($externals as $external) { 324 + $external->delete(); 325 + } 326 + 320 327 $prefs = id(new PhabricatorUserPreferences())->loadAllWhere( 321 328 'userPHID = %s', 322 329 $user->getPHID());
+17
src/applications/people/storage/PhabricatorExternalAccount.php
··· 8 8 protected $accountSecret; 9 9 protected $accountID; 10 10 protected $displayName; 11 + protected $username; 12 + protected $realName; 13 + protected $email; 14 + protected $emailVerified = 0; 15 + protected $accountURI; 16 + protected $profileImagePHID; 17 + protected $properties = array(); 11 18 12 19 public function generatePHID() { 13 20 return PhabricatorPHID::generateNewPHID( ··· 17 24 public function getConfiguration() { 18 25 return array( 19 26 self::CONFIG_AUX_PHID => true, 27 + self::CONFIG_SERIALIZATION => array( 28 + 'properties' => self::SERIALIZATION_JSON, 29 + ), 20 30 ) + parent::getConfiguration(); 21 31 } 22 32 ··· 25 35 ->makeEphemeral() 26 36 ->setPHID($this->getPHID()); 27 37 return $tmp_usr; 38 + } 39 + 40 + public function save() { 41 + if (!$this->getAccountSecret()) { 42 + $this->setAccountSecret(Filesystem::readRandomCharacters(32)); 43 + } 44 + return parent::save(); 28 45 } 29 46 30 47 }
+4
src/infrastructure/storage/patch/PhabricatorBuiltinPatchList.php
··· 1354 1354 'type' => 'sql', 1355 1355 'name' => $this->getPatchPath('20130606.userxactions.sql'), 1356 1356 ), 1357 + '20130607.xaccount.sql' => array( 1358 + 'type' => 'sql', 1359 + 'name' => $this->getPatchPath('20130607.xaccount.sql'), 1360 + ), 1357 1361 ); 1358 1362 } 1359 1363 }