Page MenuHomePhabricator

D13809.id.diff
No OneTemporary

D13809.id.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
@@ -14,6 +14,8 @@
private $includeNoLanguage;
private $dateCreatedAfter;
private $dateCreatedBefore;
+ private $statuses;
+
public function withIDs(array $ids) {
$this->ids = $ids;
@@ -67,6 +69,11 @@
return $this;
}
+ public function withStatuses(array $statuses) {
+ $this->statuses = $statuses;
+ return $this;
+ }
+
public function newResultObject() {
return new PhabricatorPaste();
}
@@ -139,6 +146,13 @@
$this->dateCreatedBefore);
}
+ if ($this->statuses !== null) {
+ $where[] = qsprintf(
+ $conn,
+ 'status IN (%Ls)',
+ $this->statuses);
+ }
+
return $where;
}
diff --git a/src/applications/paste/query/PhabricatorPasteSearchEngine.php b/src/applications/paste/query/PhabricatorPasteSearchEngine.php
--- a/src/applications/paste/query/PhabricatorPasteSearchEngine.php
+++ b/src/applications/paste/query/PhabricatorPasteSearchEngine.php
@@ -35,6 +35,10 @@
$query->withDateCreatedBefore($map['createdEnd']);
}
+ if ($map['statuses']) {
+ $query->withStatuses($map['statuses']);
+ }
+
return $query;
}
@@ -53,6 +57,12 @@
id(new PhabricatorSearchDateField())
->setKey('createdEnd')
->setLabel(pht('Created Before')),
+ id(new PhabricatorSearchCheckboxesField())
+ ->setKey('statuses')
+ ->setLabel(pht('Status'))
+ ->setOptions(
+ id(new PhabricatorPaste())
+ ->getStatusNameMap()),
);
}
@@ -70,6 +80,7 @@
protected function getBuiltinQueryNames() {
$names = array(
+ 'active' => pht('Active Pastes'),
'all' => pht('All Pastes'),
);
@@ -86,6 +97,12 @@
$query->setQueryKey($query_key);
switch ($query_key) {
+ case 'active':
+ return $query->setParameter(
+ 'statuses',
+ array(
+ PhabricatorPaste::STATUS_ACTIVE,
+ ));
case 'all':
return $query;
case 'authored':
@@ -151,6 +168,10 @@
->addIcon('none', $line_count)
->appendChild($source_code);
+ if ($paste->isArchived()) {
+ $item->setDisabled(true);
+ }
+
$lang_name = $paste->getLanguage();
if ($lang_name) {
$lang_name = idx($lang_map, $lang_name, $lang_name);

File Metadata

Mime Type
text/plain
Expires
Wed, May 22, 7:50 PM (3 w, 3 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6288118
Default Alt Text
D13809.id.diff (2 KB)

Event Timeline