Page MenuHomePhabricator

D11955.id.diff
No OneTemporary

D11955.id.diff

diff --git a/src/applications/conpherence/editor/ConpherenceEditor.php b/src/applications/conpherence/editor/ConpherenceEditor.php
--- a/src/applications/conpherence/editor/ConpherenceEditor.php
+++ b/src/applications/conpherence/editor/ConpherenceEditor.php
@@ -478,4 +478,43 @@
);
}
+ protected function validateTransaction(
+ PhabricatorLiskDAO $object,
+ $type,
+ array $xactions) {
+
+ $errors = parent::validateTransaction($object, $type, $xactions);
+
+ switch ($type) {
+ case ConpherenceTransactionType::TYPE_PARTICIPANTS:
+ foreach ($xactions as $xaction) {
+ $phids = $this->getPHIDTransactionNewValue(
+ $xaction,
+ $object->getParticipantPHIDs());
+
+ if (!$phids) {
+ continue;
+ }
+
+ $users = id(new PhabricatorPeopleQuery())
+ ->setViewer($this->requireActor())
+ ->withPHIDs($phids)
+ ->execute();
+ $users = mpull($users, null, 'getPHID');
+ foreach ($phids as $phid) {
+ if (isset($users[$phid])) {
+ continue;
+ }
+ $errors[] = new PhabricatorApplicationTransactionValidationError(
+ $type,
+ pht('Invalid'),
+ pht('New thread member "%s" is not a valid user.', $phid),
+ $xaction);
+ }
+ }
+ break;
+ }
+
+ return $errors;
+ }
}
diff --git a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
--- a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
+++ b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
@@ -1397,9 +1397,14 @@
}
protected function getPHIDTransactionNewValue(
- PhabricatorApplicationTransaction $xaction) {
+ PhabricatorApplicationTransaction $xaction,
+ $old = null) {
- $old = array_fuse($xaction->getOldValue());
+ if ($old) {
+ $old = array_fuse($old);
+ } else {
+ $old = array_fuse($xaction->getOldValue());
+ }
$new = $xaction->getNewValue();
$new_add = idx($new, '+', array());

File Metadata

Mime Type
text/plain
Expires
Fri, Oct 18, 3:30 AM (4 w, 1 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6710535
Default Alt Text
D11955.id.diff (2 KB)

Event Timeline