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

Make the Phriction "History" view more aware of drafts

Summary: Ref T13077. Updates the "History" view to be slightly better organized and draft-aware.

Test Plan: Viewed page history in Phriction.

Reviewers: amckinley

Maniphest Tasks: T13077

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

+72 -57
+69 -56
src/applications/phriction/controller/PhrictionHistoryController.php
··· 31 31 ->executeWithCursorPager($pager); 32 32 33 33 $author_phids = mpull($history, 'getAuthorPHID'); 34 - $handles = $this->loadViewerHandles($author_phids); 34 + $handles = $viewer->loadHandles($author_phids); 35 + 36 + $max_version = (int)$document->getMaxVersion(); 37 + $current_version = $document->getContent()->getVersion(); 35 38 36 39 $list = new PHUIObjectItemListView(); 37 40 $list->setFlush(true); 38 - 39 41 foreach ($history as $content) { 40 - 41 - $author = $handles[$content->getAuthorPHID()]->renderLink(); 42 42 $slug_uri = PhrictionDocument::getSlugURI($document->getSlug()); 43 43 $version = $content->getVersion(); 44 44 45 - $diff_uri = new PhutilURI('/phriction/diff/'.$document->getID().'/'); 46 - 47 - $vs_previous = null; 48 - if ($content->getVersion() != 1) { 49 - $vs_previous = $diff_uri 50 - ->alter('l', $content->getVersion() - 1) 51 - ->alter('r', $content->getVersion()); 52 - } 53 - 54 - $vs_head = null; 55 - if ($content->getPHID() != $document->getContentPHID()) { 56 - $vs_head = $diff_uri 57 - ->alter('l', $content->getVersion()) 58 - ->alter('r', $current->getVersion()); 59 - } 45 + $base_uri = new PhutilURI('/phriction/diff/'.$document->getID().'/'); 60 46 61 47 $change_type = PhrictionChangeType::getChangeTypeLabel( 62 48 $content->getChangeType()); ··· 68 54 $color = 'lightbluetext'; 69 55 break; 70 56 case PhrictionChangeType::CHANGE_MOVE_HERE: 71 - $color = 'yellow'; 57 + $color = 'yellow'; 72 58 break; 73 59 case PhrictionChangeType::CHANGE_MOVE_AWAY: 74 - $color = 'orange'; 60 + $color = 'orange'; 75 61 break; 76 62 case PhrictionChangeType::CHANGE_STUB: 77 63 $color = 'green'; 78 64 break; 79 65 default: 80 - throw new Exception(pht('Unknown change type!')); 66 + $color = 'indigo'; 81 67 break; 82 68 } 69 + 70 + $version_uri = $slug_uri.'?v='.$version; 83 71 84 72 $item = id(new PHUIObjectItemView()) 85 - ->setHeader(pht('%s by %s', $change_type, $author)) 86 - ->setStatusIcon('fa-file '.$color) 87 - ->addAttribute( 88 - phutil_tag( 89 - 'a', 90 - array( 91 - 'href' => $slug_uri.'?v='.$version, 92 - ), 93 - pht('Version %s', $version))) 94 - ->addAttribute(pht('%s %s', 95 - phabricator_date($content->getDateCreated(), $viewer), 96 - phabricator_time($content->getDateCreated(), $viewer))); 73 + ->setHref($version_uri); 74 + 75 + if ($version > $current_version) { 76 + $icon = 'fa-spinner'; 77 + $color = 'pink'; 78 + $header = pht('Draft %d', $version); 79 + } else { 80 + $icon = 'fa-file-o'; 81 + $header = pht('Version %d', $version); 82 + } 83 + 84 + if ($version == $current_version) { 85 + $item->setEffect('selected'); 86 + } 87 + 88 + $item 89 + ->setHeader($header) 90 + ->setStatusIcon($icon.' '.$color); 97 91 98 - if ($content->getDescription()) { 99 - $item->addAttribute($content->getDescription()); 92 + $description = $content->getDescription(); 93 + if (strlen($description)) { 94 + $item->addAttribute($description); 100 95 } 101 96 102 - if ($vs_previous) { 103 - $item->addIcon( 104 - 'fa-reply', 105 - pht('Show Change'), 106 - array( 107 - 'href' => $vs_previous, 108 - )); 97 + $item->addIcon( 98 + null, 99 + phabricator_datetime($content->getDateCreated(), $viewer)); 100 + 101 + $author_phid = $content->getAuthorPHID(); 102 + $item->addByline($viewer->renderHandle($author_phid)); 103 + 104 + $diff_uri = null; 105 + if ($version > 1) { 106 + $diff_uri = $base_uri 107 + ->alter('l', $version - 1) 108 + ->alter('r', $version); 109 109 } else { 110 - $item->addIcon( 111 - 'fa-reply grey', 112 - phutil_tag('em', array(), pht('No previous change'))); 110 + $diff_uri = null; 113 111 } 114 112 115 - if ($vs_head) { 116 - $item->addIcon( 117 - 'fa-reply-all', 118 - pht('Show Later Changes'), 119 - array( 120 - 'href' => $vs_head, 121 - )); 113 + if ($content->getVersion() != $max_version) { 114 + $compare_uri = $base_uri 115 + ->alter('l', $version) 116 + ->alter('r', $max_version); 122 117 } else { 123 - $item->addIcon( 124 - 'fa-reply-all grey', 125 - phutil_tag('em', array(), pht('No later changes'))); 118 + $compare_uri = null; 126 119 } 120 + 121 + $button_bar = id(new PHUIButtonBarView()) 122 + ->addButton( 123 + id(new PHUIButtonView()) 124 + ->setTag('a') 125 + ->setColor('grey') 126 + ->setIcon('fa-chevron-down') 127 + ->setDisabled(!$diff_uri) 128 + ->setHref($diff_uri) 129 + ->setText(pht('Diff'))) 130 + ->addButton( 131 + id(new PHUIButtonView()) 132 + ->setTag('a') 133 + ->setColor('grey') 134 + ->setIcon('fa-chevron-circle-up') 135 + ->setDisabled(!$compare_uri) 136 + ->setHref($compare_uri) 137 + ->setText(pht('Compare'))); 138 + 139 + $item->setSideColumn($button_bar); 127 140 128 141 $list->addItem($item); 129 142 }
+3 -1
src/view/phui/PHUIObjectItemView.php
··· 709 709 } 710 710 711 711 /* Fixed width, right column container. */ 712 + $column3 = null; 712 713 if ($this->sideColumn) { 713 - $column2 = phutil_tag( 714 + $column3 = phutil_tag( 714 715 'div', 715 716 array( 716 717 'class' => 'phui-oi-col2 phui-oi-side-column', ··· 731 732 $column0, 732 733 $column1, 733 734 $column2, 735 + $column3, 734 736 ))); 735 737 736 738 $box = phutil_tag(