Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2891535
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
2 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/src/applications/pholio/xaction/PholioImageNameTransaction.php b/src/applications/pholio/xaction/PholioImageNameTransaction.php
index 33b01903ee..f4705a98fc 100644
--- a/src/applications/pholio/xaction/PholioImageNameTransaction.php
+++ b/src/applications/pholio/xaction/PholioImageNameTransaction.php
@@ -1,85 +1,85 @@
<?php
final class PholioImageNameTransaction
extends PholioImageTransactionType {
const TRANSACTIONTYPE = 'image-name';
public function generateOldValue($object) {
$name = null;
$phid = null;
$image = $this->getImageForXaction($object);
if ($image) {
$name = $image->getName();
$phid = $image->getPHID();
}
return array($phid => $name);
}
public function applyInternalEffects($object, $value) {
$image = $this->getImageForXaction($object);
$value = (string)head($this->getNewValue());
$image->setName($value);
$image->save();
}
public function getTitle() {
$old = $this->getOldValue();
$new = $this->getNewValue();
return pht(
'%s renamed an image (%s) from %s to %s.',
$this->renderAuthor(),
$this->renderHandle(key($new)),
- $this->renderValue($old),
- $this->renderValue($new));
+ $this->renderValue((string)head($old)),
+ $this->renderValue((string)head($new)));
}
public function getTitleForFeed() {
return pht(
'%s updated the image names of %s.',
$this->renderAuthor(),
$this->renderObject());
}
public function mergeTransactions(
$object,
PhabricatorApplicationTransaction $u,
PhabricatorApplicationTransaction $v) {
$raw_new_value_u = $u->getNewValue();
$raw_new_value_v = $v->getNewValue();
$phid_u = head_key($raw_new_value_u);
$phid_v = head_key($raw_new_value_v);
if ($phid_u == $phid_v) {
return $v;
}
return null;
}
public function shouldHide() {
$old = $this->getOldValue();
return ($old === array(null => null));
}
public function validateTransactions($object, array $xactions) {
$errors = array();
$max_length = $object->getColumnMaximumByteLength('name');
foreach ($xactions as $xaction) {
$new_value = head(array_values($xaction->getNewValue()));
$new_length = strlen($new_value);
if ($new_length > $max_length) {
$errors[] = $this->newInvalidError(
pht(
'Mock image names must not be longer than %s character(s).',
new PhutilNumber($max_length)));
}
}
return $errors;
}
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sun, Jan 19, 15:20 (3 w, 1 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1125933
Default Alt Text
(2 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment