@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.

Standardize rendering of atom type names like "Article" and "Class"

Summary: Ref T988. This was sort of hard-coded in one place and not done properly in another. Do it consistently.

Test Plan: Looked at atom list; looked at atom view. Saw "Article", "Class" rendered correctly.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T988

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

+35 -10
+31 -4
src/applications/diviner/atom/DivinerAtom.php
··· 5 5 const TYPE_FILE = 'file'; 6 6 const TYPE_ARTICLE = 'article'; 7 7 const TYPE_METHOD = 'method'; 8 + const TYPE_CLASS = 'class'; 9 + const TYPE_FUNCTION = 'function'; 10 + const TYPE_INTERFACE = 'interface'; 8 11 9 12 private $type; 10 13 private $name; ··· 357 360 358 361 public static function getThisAtomIsNotDocumentedString($type) { 359 362 switch ($type) { 360 - case 'function': 363 + case self::TYPE_FILE: 364 + return pht('This file is not documented.'); 365 + case self::TYPE_FUNCTION: 361 366 return pht('This function is not documented.'); 362 - case 'class': 367 + case self::TYPE_CLASS: 363 368 return pht('This class is not documented.'); 364 - case 'article': 369 + case self::TYPE_ARTICLE: 365 370 return pht('This article is not documented.'); 366 - case 'method': 371 + case self::TYPE_METHOD: 367 372 return pht('This method is not documented.'); 373 + case self::TYPE_INTERFACE: 374 + return pht('This interface is not documented.'); 368 375 default: 369 376 phlog("Need translation for '{$type}'."); 370 377 return pht('This %s is not documented.', $type); 378 + } 379 + } 380 + 381 + public static function getAtomTypeNameString($type) { 382 + switch ($type) { 383 + case self::TYPE_FILE: 384 + return pht('File'); 385 + case self::TYPE_FUNCTION: 386 + return pht('Function'); 387 + case self::TYPE_CLASS: 388 + return pht('Class'); 389 + case self::TYPE_ARTICLE: 390 + return pht('Article'); 391 + case self::TYPE_METHOD: 392 + return pht('Method'); 393 + case self::TYPE_INTERFACE: 394 + return pht('Interface'); 395 + default: 396 + phlog("Need translation for '{$type}'."); 397 + return ucwords($type); 371 398 } 372 399 } 373 400
+1 -5
src/applications/diviner/controller/DivinerAtomController.php
··· 89 89 id(new PhabricatorTagView()) 90 90 ->setType(PhabricatorTagView::TYPE_STATE) 91 91 ->setBackgroundColor(PhabricatorTagView::COLOR_BLUE) 92 - ->setName($this->renderAtomTypeName($atom->getType()))); 92 + ->setName(DivinerAtom::getAtomTypeNameString($atom->getType()))); 93 93 94 94 $properties = id(new PhabricatorPropertyListView()); 95 95 ··· 206 206 'title' => $symbol->getTitle(), 207 207 'device' => true, 208 208 )); 209 - } 210 - 211 - private function renderAtomTypeName($name) { 212 - return phutil_utf8_ucwords($name); 213 209 } 214 210 215 211 private function buildExtendsAndImplements(
+3 -1
src/applications/diviner/controller/DivinerController.php
··· 34 34 $item = id(new PhabricatorObjectItemView()) 35 35 ->setHeader($symbol->getTitle()) 36 36 ->setHref($symbol->getURI()) 37 - ->addIcon('none', $symbol->getType()); 37 + ->addIcon('none', 38 + DivinerAtom::getAtomTypeNameString( 39 + $symbol->getType())); 38 40 39 41 $item->addAttribute(phutil_safe_html($symbol->getSummary())); 40 42