@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
at recaptime-dev/main 61 lines 1.9 kB view raw
1<?php 2 3final class PhabricatorConfigIgnoreController 4 extends PhabricatorConfigController { 5 6 public function handleRequest(AphrontRequest $request) { 7 $viewer = $request->getViewer(); 8 $issue = $request->getURIData('key'); 9 $verb = $request->getURIData('verb'); 10 11 $issue_uri = $this->getApplicationURI('issue/'.$issue.'/'); 12 13 if ($request->isDialogFormPost()) { 14 $this->manageApplication($issue); 15 return id(new AphrontRedirectResponse())->setURI($issue_uri); 16 } 17 18 if ($verb == 'ignore') { 19 $title = pht('Really ignore this setup issue?'); 20 $submit_title = pht('Ignore'); 21 $body = pht( 22 "You can ignore an issue if you don't want to fix it, or plan to ". 23 "fix it later. Ignored issues won't appear on every page but will ". 24 "still be shown in the list of open issues."); 25 } else if ($verb == 'unignore') { 26 $title = pht('Unignore this setup issue?'); 27 $submit_title = pht('Unignore'); 28 $body = pht( 29 'This issue will no longer be suppressed, and will return to its '. 30 'rightful place as a global setup warning.'); 31 } else { 32 throw new Exception(pht('Unrecognized verb: %s', $verb)); 33 } 34 35 return $this->newDialog() 36 ->setTitle($title) 37 ->appendChild($body) 38 ->addSubmitButton($submit_title) 39 ->addCancelButton($issue_uri); 40 41 } 42 43 public function manageApplication($issue) { 44 $key = 'config.ignore-issues'; 45 $config_entry = PhabricatorConfigEntry::loadConfigEntry($key); 46 $list = $config_entry->getValue(); 47 48 if (isset($list[$issue])) { 49 unset($list[$issue]); 50 } else { 51 $list[$issue] = true; 52 } 53 54 PhabricatorConfigEditor::storeNewValue( 55 $this->getRequest()->getUser(), 56 $config_entry, 57 $list, 58 PhabricatorContentSource::newFromRequest($this->getRequest())); 59 } 60 61}