Skip to content

Commit f76ecd9

Browse files
afaquejamepriestley
authored and
epriestley
committedMay 6, 2013
Adding Handle Suport
Summary: Added PHID_TYPE_XUSR to loadObjectsofType() of PhabricatorObjectHandle data. Was trying to solve the setActor() issue. Created a getPhabricator method in PhabricatorExternalAccount. When I try to set authorPHID using setAuthorPHID() in PhabricatorExternalAccount it's saying bad setter call, if I don't, then it's saying authorPHID can't be null. Sending you diff for comments on this. Test Plan: {F42523} {F42525} Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin, AnhNhan Differential Revision: https://secure.phabricator.com/D5839
1 parent 16ba027 commit f76ecd9

File tree

3 files changed

+33
-2
lines changed

3 files changed

+33
-2
lines changed
 

‎src/applications/metamta/storage/PhabricatorMetaMTAReceivedMail.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -260,10 +260,10 @@ public function processReceivedMail() {
260260
$receiver->setPriority(ManiphestTaskPriority::PRIORITY_TRIAGE);
261261

262262
$editor = new ManiphestTransactionEditor();
263-
$editor->setActor($user);
263+
$editor->setActor($user->getPhabricatorUser());
264264
$handler = $editor->buildReplyHandler($receiver);
265265

266-
$handler->setActor($user);
266+
$handler->setActor($user->getPhabricatorUser());
267267
$handler->setExcludeMailRecipientPHIDs(
268268
$this->loadExcludeMailRecipientPHIDs());
269269
$handler->processEmail($this);

‎src/applications/people/storage/PhabricatorExternalAccount.php

+7
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,11 @@ public function getConfiguration() {
2020
) + parent::getConfiguration();
2121
}
2222

23+
public function getPhabricatorUser() {
24+
$tmp_usr = id(new PhabricatorUser())
25+
->makeEphemeral()
26+
->setPHID($this->getPHID());
27+
return $tmp_usr;
28+
}
29+
2330
}

‎src/applications/phid/handle/PhabricatorObjectHandleData.php

+24
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,13 @@ private function loadObjectsOfType($type, array $phids) {
205205
->execute();
206206
return mpull($vars, null, 'getPHID');
207207

208+
case PhabricatorPHIDConstants::PHID_TYPE_XUSR:
209+
$xusr_dao = new PhabricatorExternalAccount();
210+
$xusrs = $xusr_dao->loadAllWhere(
211+
'phid in (%Ls)',
212+
$phids);
213+
return mpull($xusrs, null, 'getPHID');
214+
208215
}
209216
}
210217

@@ -681,6 +688,23 @@ public function loadHandles() {
681688
}
682689
break;
683690

691+
case PhabricatorPHIDConstants::PHID_TYPE_XUSR:
692+
foreach ($phids as $phid) {
693+
$handle = new PhabricatorObjectHandle();
694+
$handle->setPHID($phid);
695+
$handle->setType($type);
696+
if (empty($objects[$phid])) {
697+
$handle->setName('Unknown Display Name');
698+
} else {
699+
$xusr = $objects[$phid];
700+
$display_name = $xusr->getDisplayName();
701+
$handle->setName($display_name);
702+
$handle->setFullName($display_name.' (External User)');
703+
}
704+
$handles[$phid] = $handle;
705+
}
706+
break;
707+
684708
default:
685709
$loader = null;
686710
if (isset($external_loaders[$type])) {

0 commit comments

Comments
 (0)
Failed to load comments.