Page MenuHomePhabricator

D20311.id.diff
No OneTemporary

D20311.id.diff

diff --git a/src/applications/legalpad/xaction/LegalpadDocumentRequireSignatureTransaction.php b/src/applications/legalpad/xaction/LegalpadDocumentRequireSignatureTransaction.php
--- a/src/applications/legalpad/xaction/LegalpadDocumentRequireSignatureTransaction.php
+++ b/src/applications/legalpad/xaction/LegalpadDocumentRequireSignatureTransaction.php
@@ -55,11 +55,22 @@
public function validateTransactions($object, array $xactions) {
$errors = array();
- $is_admin = $this->getActor()->getIsAdmin();
+ $old = (bool)$object->getRequireSignature();
+ foreach ($xactions as $xaction) {
+ $new = (bool)$xaction->getNewValue();
- if (!$is_admin) {
- $errors[] = $this->newInvalidError(
- pht('Only admins may require signature.'));
+ if ($old === $new) {
+ continue;
+ }
+
+ $is_admin = $this->getActor()->getIsAdmin();
+ if (!$is_admin) {
+ $errors[] = $this->newInvalidError(
+ pht(
+ 'Only administrators may change whether a document '.
+ 'requires a signature.'),
+ $xaction);
+ }
}
return $errors;

File Metadata

Mime Type
text/plain
Expires
Sun, Mar 30, 12:41 PM (6 d, 9 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7649180
Default Alt Text
D20311.id.diff (1 KB)

Event Timeline