@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add application search for Paste status

Summary: Fixes T9076. This adds the ability to search for active, archived, or all Pastes.

Test Plan: Search for active, archived, all Pastes.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Maniphest Tasks: T9076

Differential Revision: https://secure.phabricator.com/D13809

+35
+14
src/applications/paste/query/PhabricatorPasteQuery.php
··· 14 14 private $includeNoLanguage; 15 15 private $dateCreatedAfter; 16 16 private $dateCreatedBefore; 17 + private $statuses; 18 + 17 19 18 20 public function withIDs(array $ids) { 19 21 $this->ids = $ids; ··· 64 66 65 67 public function withDateCreatedAfter($date_created_after) { 66 68 $this->dateCreatedAfter = $date_created_after; 69 + return $this; 70 + } 71 + 72 + public function withStatuses(array $statuses) { 73 + $this->statuses = $statuses; 67 74 return $this; 68 75 } 69 76 ··· 137 144 $conn, 138 145 'dateCreated <= %d', 139 146 $this->dateCreatedBefore); 147 + } 148 + 149 + if ($this->statuses !== null) { 150 + $where[] = qsprintf( 151 + $conn, 152 + 'status IN (%Ls)', 153 + $this->statuses); 140 154 } 141 155 142 156 return $where;
+21
src/applications/paste/query/PhabricatorPasteSearchEngine.php
··· 35 35 $query->withDateCreatedBefore($map['createdEnd']); 36 36 } 37 37 38 + if ($map['statuses']) { 39 + $query->withStatuses($map['statuses']); 40 + } 41 + 38 42 return $query; 39 43 } 40 44 ··· 53 57 id(new PhabricatorSearchDateField()) 54 58 ->setKey('createdEnd') 55 59 ->setLabel(pht('Created Before')), 60 + id(new PhabricatorSearchCheckboxesField()) 61 + ->setKey('statuses') 62 + ->setLabel(pht('Status')) 63 + ->setOptions( 64 + id(new PhabricatorPaste()) 65 + ->getStatusNameMap()), 56 66 ); 57 67 } 58 68 ··· 70 80 71 81 protected function getBuiltinQueryNames() { 72 82 $names = array( 83 + 'active' => pht('Active Pastes'), 73 84 'all' => pht('All Pastes'), 74 85 ); 75 86 ··· 86 97 $query->setQueryKey($query_key); 87 98 88 99 switch ($query_key) { 100 + case 'active': 101 + return $query->setParameter( 102 + 'statuses', 103 + array( 104 + PhabricatorPaste::STATUS_ACTIVE, 105 + )); 89 106 case 'all': 90 107 return $query; 91 108 case 'authored': ··· 150 167 ->addIcon('none', $created) 151 168 ->addIcon('none', $line_count) 152 169 ->appendChild($source_code); 170 + 171 + if ($paste->isArchived()) { 172 + $item->setDisabled(true); 173 + } 153 174 154 175 $lang_name = $paste->getLanguage(); 155 176 if ($lang_name) {