Page MenuHomePhabricator

D11955.id28781.diff
No OneTemporary

D11955.id28781.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
Sun, Oct 20, 1:51 PM (3 w, 5 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6710535
Default Alt Text
D11955.id28781.diff (2 KB)

Event Timeline