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

Fix every HTML issue I could find

Summary:
I attempted to test every interface. I probably missed some stuff, but I at least have some level of confidence that the `phutil_tag` branch is fairly stable.

Fixed these issues:

[1] Fixed a Herald issue with object links in transcripts. Some actions return
links; this was previously hard-coded.
[2] DarkConsole refactoring created an issue where the "`" event handler registered too many times.
[3] Fixed a bug where `strlen($value)` was being checked, but fields may now return array(). Possibly we should implement phutil_is_empty_html() or similar.
[4] Fixed a undefined variable issue for image edit transactions.
[5] Fixed an issue with rendering participant transactions. This required phutil_safe_html() because `pht()` can't handle `array()` for `%s`.
[6] Fixed an issue where feed was entirely overescaped by reverting an overly ambitious render_tag -> tag.
[7] Fixed an issue with strict tables and inserting `''` instead of `0` into an integer column.
[8] Fixed an issue where • was shown escaped.
[9] Fixed an issue where "no data" was overescaped.
[10] Fixed an issue with strict tables and inserting `''` instead of `0` into an integer column.
[11] Fixed an issue with strict tables and inserting `''`.
[12] Fixed an issue with missing space after ":" for mini panels.

Encountered (but did not fix) these issues:

[X1] "e" works incorrectly on comments you are not allowed to edit. Did not fix.
[X2] Coverage currently interacts incorrectly with "--everything" for Phutil tests.

Test Plan:
- Viewed Differential.
- Created a diff via copy/paste.
- Viewed standalone diff.
- Jumped to diff via changeset table.
- Created a revision.
- Updated revision.
- Added a comment.
- Edited revision dependencies.
- Edited revision tasks.
- Viewed MetaMTA transcripts.
- Viewed Herald transcripts [1].
- Downloaded raw diff.
- Flagged / unflagged revision.
- Added/edited/deleted inline comment.
- Collapsed/expanded file.
- Did show raw left.
- Did show raw right.
- Checked previews for available actions.
- Clicked remarkup buttons
- Used filetree view.
- Used keyboard: F, j, k, J, K, n, p, t, h, "?" [2] [X1].
- Created a meme.
- Uploaded a file via drag and drop.
- Viewed a revision with no reviewers.
- Viewed a revision with >100 files.
- Viewed various other revisions [3].
- Viewed an image diff.
- Added image diff inline comments.
- Viewed Maniphest.
- Ran various queries.
- Created task.
- Created similar task.
- Added comments to tasks.
- Ran custom query.
- Saved custom query.
- Edited custom queries.
- Drag-reordered tasks.
- Batch edited tasks.
- Exported tasks to excel.
- Looked at reports (issue in T2311 notwithstanding).
- Viewed Diffusion.
- Browsed Git, SVN, HG repositories.
- Looked at history, browse, change, commit views.
- Viewed audit.
- Performed various audit searches.
- Viewed Paste.
- Performed paste searches.
- Created, edited, forked paste.
- Viewed Phriction.
- Edited a page.
- Viewed edit history.
- Used search typeahead to search for user / application.
- Used search to search for text.
- Viewed Phame.
- Viewed Blog, Post.
- Viewed live post.
- Published/unpublished post.
- Previewed post.
- Viewed Pholio.
- Edited/commented mock.
- Viewed ponder.
- Viewed question.
- Added answer/comment.
- Viewed Diviner.
- Viewed Conpherence [4] [5].
- Made Conpherence updates.
- Viewed calendar.
- Created status.
- Viewed status.
- Viewed Feed [6].
- Viewed Projects.
- Viewed project detail.
- Edited project.
- Viewed Owners.
- Viewed package detail.
- Edited package [7].
- Viewed flags.
- Edited flag.
- Deleted flag.
- Viewed Herald.
- Viewed rules.
- Created rule.
- Edited rule.
- Viewed edit log.
- Viewed transcripts.
- Inspected a transcript.
- Viewed People.
- Viewed list.
- Administrated user.
- Checked username/delete stuff.
- Looked at create/import LDAP/activity logs.
- Looked at a user profile.
- Looked at user about page.
- Looked at Repositories.
- Edited repository.
- Edited arcanist project.
- Looked at daemons.
- Looked at all daemons [8].
- Viewed combined log.
- Looked at configuration.
- Edited configuration.
- Looked at setup issues [9].
- Looked at current settings.
- Looked at application list.
- Installed / uninstalled applications [10].
- Looked at mailing lists.
- Created a mailing list.
- Edited a mailing list.
- Looked at sent mail.
- Looked at received mail.
- Looked at send/receive tests.
- Looked at settings.
- Clicked through all the panels.
- Looked at slowvote.
- Created a slowvote [11].
- Voted in a slowvote.
- Looked at Macro.
- Created a macro.
- Edited a macro.
- Commented on a macro.
- Looked at Countdown.
- Created a Countdown.
- Looked at it.
- Looked at Drydock.
- Poked around a bit.
- Looked at Fact.
- Poked around a bit.
- Looked at files.
- Looked at a file.
- Uploaded a file.
- Looked at Conduit.
- Made a Conduit call.
- Looked at UIExamples.
- Looked at PHPAST.
- Looked at PHIDs.
- Looked at notification menu.
- Looked at notification detail.
- Logged out.
- Logged in.
- Looked at homepage [12].
- Ran `arc unit --everything --no-coverage` [X2].

Reviewers: vrana, btrahan

Reviewed By: vrana

CC: aran

Maniphest Tasks: T2432

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

+64 -53
+2 -2
src/applications/config/editor/PhabricatorConfigEditor.php
··· 18 18 switch ($xaction->getTransactionType()) { 19 19 case PhabricatorConfigTransaction::TYPE_EDIT: 20 20 return array( 21 - 'deleted' => (bool)$object->getIsDeleted(), 21 + 'deleted' => (int)$object->getIsDeleted(), 22 22 'value' => $object->getValue(), 23 23 ); 24 24 } ··· 54 54 $v['value']); 55 55 } 56 56 57 - $object->setIsDeleted($v['deleted']); 57 + $object->setIsDeleted((int)$v['deleted']); 58 58 $object->setValue($v['value']); 59 59 break; 60 60 }
+3 -1
src/applications/conpherence/controller/ConpherenceController.php
··· 155 155 $item->addClass('conpherence-selected'); 156 156 $item->addClass('hide-unread-count'); 157 157 } 158 - $nav->addCustomBlock($item->render()); 158 + 159 + // TODO: [HTML] Clean this up when we clean up HTML stuff in Conpherence. 160 + $nav->addCustomBlock(phutil_safe_html($item->render())); 159 161 } 160 162 if (empty($conpherences) || $read) { 161 163 $nav->addCustomBlock($this->getNoConpherencesBlock());
+1
src/applications/conpherence/view/ConpherenceTransactionView.php
··· 35 35 ->setEpoch($transaction->getDateCreated()) 36 36 ->setContentSource($transaction->getContentSource()); 37 37 38 + $content = null; 38 39 $content_class = null; 39 40 switch ($transaction->getTransactionType()) { 40 41 case ConpherenceTransactionType::TYPE_TITLE:
+3 -3
src/applications/daemon/view/PhabricatorDaemonLogListView.php
··· 47 47 case PhabricatorDaemonLog::STATUS_RUNNING: 48 48 $style = 'color: #00cc00'; 49 49 $title = 'Running'; 50 - $symbol = '•'; 50 + $symbol = "\xE2\x80\xA2"; 51 51 break; 52 52 case PhabricatorDaemonLog::STATUS_DEAD: 53 53 $style = 'color: #cc0000'; 54 54 $title = 'Died'; 55 - $symbol = '•'; 55 + $symbol = "\xE2\x80\xA2"; 56 56 break; 57 57 case PhabricatorDaemonLog::STATUS_EXITED: 58 58 $style = 'color: #000000'; 59 59 $title = 'Exited'; 60 - $symbol = '•'; 60 + $symbol = "\xE2\x80\xA2"; 61 61 break; 62 62 case PhabricatorDaemonLog::STATUS_UNKNOWN: 63 63 default: // fallthrough
+7 -4
src/applications/differential/view/DifferentialChangesetFileTreeSideNavBuilder.php
··· 116 116 } 117 117 $tree->destroy(); 118 118 119 - $filetree = 120 - '<div class="phabricator-filetree">'. 121 - implode("\n", $filetree). 122 - '</div>'; 119 + $filetree = phutil_tag( 120 + 'div', 121 + array( 122 + 'class' => 'phabricator-filetree', 123 + ), 124 + $filetree); 125 + 123 126 $nav->addLabel(pht('Changed Files')); 124 127 $nav->addCustomBlock($filetree); 125 128 $nav->setActive(true);
+1 -1
src/applications/differential/view/DifferentialRevisionDetailView.php
··· 80 80 81 81 foreach ($this->auxiliaryFields as $field) { 82 82 $value = $field->renderValueForRevisionView(); 83 - if (strlen($value)) { 83 + if ($value !== null) { 84 84 $label = rtrim($field->renderLabelForRevisionView(), ':'); 85 85 $properties->addProperty($label, $value); 86 86 }
+1 -1
src/applications/directory/controller/PhabricatorDirectoryMainController.php
··· 345 345 array( 346 346 ), 347 347 array( 348 - phutil_tag('strong', array(), $title.':'), 348 + phutil_tag('strong', array(), $title.': '), 349 349 $body 350 350 ))); 351 351 $this->minipanels[] = $panel;
+2 -2
src/applications/feed/view/PhabricatorFeedStoryView.php
··· 111 111 112 112 require_celerity_resource('phabricator-feed-css'); 113 113 114 - return phutil_tag( 114 + return phutil_render_tag( 115 115 'div', 116 116 array( 117 117 'class' => $this->oneLine ··· 119 119 : 'phabricator-feed-story', 120 120 'style' => $image_style, 121 121 ), 122 - array($head, $body, $foot)); 122 + $this->renderSingleView(array($head, $body, $foot))); 123 123 } 124 124 125 125 }
+14 -14
src/applications/herald/controller/HeraldTranscriptController.php
··· 476 476 477 477 $rows = array(); 478 478 foreach ($data as $name => $value) { 479 - if (!is_scalar($value) && !is_null($value)) { 480 - $value = implode("\n", $value); 481 - } 479 + if (!($value instanceof PhutilSafeHTML)) { 480 + if (!is_scalar($value) && !is_null($value)) { 481 + $value = implode("\n", $value); 482 + } 482 483 483 - if (strlen($value) > 256) { 484 - $value = phutil_tag( 485 - 'textarea', 486 - array( 487 - 'class' => 'herald-field-value-transcript', 488 - ), 489 - $value); 490 - } else if ($name === 'Object Link') { 491 - // The link cannot be escaped 492 - } else { 493 - $value = phutil_escape_html($value); 484 + if (strlen($value) > 256) { 485 + $value = phutil_tag( 486 + 'textarea', 487 + array( 488 + 'class' => 'herald-field-value-transcript', 489 + ), 490 + $value); 491 + } else { 492 + $value = phutil_escape_html($value); 493 + } 494 494 } 495 495 496 496 $rows[] = array(
+4 -1
src/applications/owners/controller/PhabricatorOwnersEditController.php
··· 32 32 $package->setName($request->getStr('name')); 33 33 $package->setDescription($request->getStr('description')); 34 34 $old_auditing_enabled = $package->getAuditingEnabled(); 35 - $package->setAuditingEnabled($request->getStr('auditing') === 'enabled'); 35 + $package->setAuditingEnabled( 36 + ($request->getStr('auditing') === 'enabled') 37 + ? 1 38 + : 0); 36 39 37 40 $primary = $request->getArr('primary'); 38 41 $primary = reset($primary);
+1 -1
src/applications/slowvote/controller/PhabricatorSlowvoteCreateController.php
··· 23 23 if ($request->isFormPost()) { 24 24 $poll->setQuestion($request->getStr('question')); 25 25 $poll->setResponseVisibility($request->getInt('response_visibility')); 26 - $poll->setShuffle($request->getBool('shuffle', false)); 26 + $poll->setShuffle((int)$request->getBool('shuffle', false)); 27 27 $poll->setMethod($request->getInt('method')); 28 28 29 29 if (!strlen($poll->getQuestion())) {
+1 -1
src/applications/transactions/storage/PhabricatorApplicationTransaction.php
··· 143 143 foreach ($phids as $phid) { 144 144 $links[] = $this->renderHandleLink($phid); 145 145 } 146 - return implode(', ', $links); 146 + return phutil_safe_html(implode(', ', $links)); 147 147 } 148 148 149 149 public function getIcon() {
+1 -2
src/view/layout/PhabricatorObjectItemListView.php
··· 53 53 $string = nonempty($this->noDataString, pht('No data.')); 54 54 $items = id(new AphrontErrorView()) 55 55 ->setSeverity(AphrontErrorView::SEVERITY_NODATA) 56 - ->appendChild(phutil_escape_html($string)) 57 - ->render(); 56 + ->appendChild(phutil_escape_html($string)); 58 57 } 59 58 60 59 $pager = null;
+23 -20
webroot/rsrc/js/application/core/behavior-dark-console.js
··· 40 40 statics.visible = config.visible; 41 41 statics.selected = config.selected; 42 42 43 + install_shortcut(); 44 + 43 45 return statics.root; 44 46 } 45 47 ··· 202 204 JX.DOM.setContent(statics.el.panel, div); 203 205 } 204 206 205 - // Install keyboard shortcut. 206 - var desc = 'Toggle visibility of DarkConsole.'; 207 - new JX.KeyboardShortcut('`', desc) 208 - .setHandler(function(manager) { 209 - statics.visible = !statics.visible; 207 + function install_shortcut() { 208 + var desc = 'Toggle visibility of DarkConsole.'; 209 + new JX.KeyboardShortcut('`', desc) 210 + .setHandler(function(manager) { 211 + statics.visible = !statics.visible; 210 212 211 - if (statics.visible) { 212 - JX.DOM.show(root); 213 - if (statics.req.current) { 214 - draw_request(statics.req.current); 213 + if (statics.visible) { 214 + JX.DOM.show(root); 215 + if (statics.req.current) { 216 + draw_request(statics.req.current); 217 + } 218 + } else { 219 + JX.DOM.hide(root); 215 220 } 216 - } else { 217 - JX.DOM.hide(root); 218 - } 219 221 220 - // Save user preference. 221 - new JX.Request('/~/', JX.bag) 222 - .setData({visible: statics.visible ? 1 : 0}) 223 - .send(); 222 + // Save user preference. 223 + new JX.Request('/~/', JX.bag) 224 + .setData({visible: statics.visible ? 1 : 0}) 225 + .send(); 224 226 225 - // Force resize listeners to take effect. 226 - JX.Stratcom.invoke('resize'); 227 - }) 228 - .register(); 227 + // Force resize listeners to take effect. 228 + JX.Stratcom.invoke('resize'); 229 + }) 230 + .register(); 231 + } 229 232 230 233 });