Page MenuHomePhabricator

D16473.id39637.diff
No OneTemporary

D16473.id39637.diff

diff --git a/src/applications/paste/query/PhabricatorPasteQuery.php b/src/applications/paste/query/PhabricatorPasteQuery.php
--- a/src/applications/paste/query/PhabricatorPasteQuery.php
+++ b/src/applications/paste/query/PhabricatorPasteQuery.php
@@ -173,6 +173,7 @@
'P'.$paste->getID(),
$paste->getFilePHID(),
$paste->getLanguage(),
+ PhabricatorHash::digestForIndex($paste->getTitle()),
));
}
@@ -184,6 +185,7 @@
$paste->getFilePHID(),
$paste->getLanguage(),
'snippet',
+ PhabricatorHash::digestForIndex($paste->getTitle()),
));
}
diff --git a/src/applications/paste/xaction/PhabricatorPasteLanguageTransaction.php b/src/applications/paste/xaction/PhabricatorPasteLanguageTransaction.php
--- a/src/applications/paste/xaction/PhabricatorPasteLanguageTransaction.php
+++ b/src/applications/paste/xaction/PhabricatorPasteLanguageTransaction.php
@@ -13,12 +13,20 @@
$object->setLanguage($value);
}
+ private function emptyToAutodetect($value) {
+ if (empty($value)) {
+ return $this->renderValue('autodetect');
+ } else {
+ return $this->renderValue($value);
+ }
+ }
+
public function getTitle() {
return pht(
"%s updated the paste's language from %s to %s.",
$this->renderAuthor(),
- $this->renderOldValue(),
- $this->renderNewValue());
+ $this->emptyToAutodetect($this->getOldValue()),
+ $this->emptyToAutodetect($this->getNewValue()));
}
public function getTitleForFeed() {
@@ -26,8 +34,8 @@
'%s updated the language for %s from %s to %s.',
$this->renderAuthor(),
$this->renderObject(),
- $this->renderOldValue(),
- $this->renderNewValue());
+ $this->emptyToAutodetect($this->getOldValue()),
+ $this->emptyToAutodetect($this->getNewValue()));
}
}
diff --git a/src/applications/phurl/controller/PhabricatorPhurlURLViewController.php b/src/applications/phurl/controller/PhabricatorPhurlURLViewController.php
--- a/src/applications/phurl/controller/PhabricatorPhurlURLViewController.php
+++ b/src/applications/phurl/controller/PhabricatorPhurlURLViewController.php
@@ -86,7 +86,7 @@
->setTag('a')
->setText(pht('Visit URL'))
->setIcon('fa-external-link')
- ->setHref("u/{$id}")
+ ->setHref($url->getRedirectURI())
->setDisabled(!$url->isValid());
$header = id(new PHUIHeaderView())
@@ -130,6 +130,10 @@
->setUser($viewer);
$properties->addProperty(
+ pht('Short URL'),
+ $url->getRedirectURI());
+
+ $properties->addProperty(
pht('Original URL'),
$url->getLongURL());
diff --git a/src/applications/phurl/storage/PhabricatorPhurlURL.php b/src/applications/phurl/storage/PhabricatorPhurlURL.php
--- a/src/applications/phurl/storage/PhabricatorPhurlURL.php
+++ b/src/applications/phurl/storage/PhabricatorPhurlURL.php
@@ -99,10 +99,18 @@
public function getRedirectURI() {
if (strlen($this->getAlias())) {
- return '/u/'.$this->getAlias();
+ $path = '/u/'.$this->getAlias();
} else {
- return '/u/'.$this->getID();
+ $path = '/u/'.$this->getID();
}
+ $short_domain = PhabricatorEnv::getEnvConfig('phurl.short-uri');
+ if (!$short_domain) {
+ return $path;
+ }
+
+ $uri = new PhutilURI($short_domain);
+ $uri->setPath($path);
+ return (string)$uri;
}
/* -( PhabricatorPolicyInterface )----------------------------------------- */

File Metadata

Mime Type
text/plain
Expires
Fri, Apr 4, 3:53 PM (3 d, 17 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7715938
Default Alt Text
D16473.id39637.diff (3 KB)

Event Timeline