Page MenuHomePhabricator

Remarkup chat log entries
Needs RevisionPublic

Authored by kouiskas on Dec 3 2013, 7:42 PM.
Tags
None
Referenced Files
F14024695: D7691.diff
Thu, Nov 7, 11:36 AM
F14009733: D7691.diff
Wed, Oct 30, 11:29 PM
F13988084: D7691.diff
Mon, Oct 21, 1:03 PM
F13955312: D7691.diff
Mon, Oct 14, 12:55 AM
Unknown Object (File)
Oct 2 2024, 6:10 AM
Unknown Object (File)
Sep 10 2024, 1:19 PM
Unknown Object (File)
Sep 4 2024, 9:57 AM
Unknown Object (File)
Sep 4 2024, 9:57 AM

Details

Reviewers
epriestley
btrahan
Group Reviewers
Blessed Reviewers
Summary

Slightly improve the chat log functionality by making it parse ticket numbers, links, etc. This is my first venture into patching phabricator, almost certainly not the most efficient way to achieve this result.

Test Plan

Visit a chat log, see that it's now parsed...

Diff Detail

Branch
master
Lint
Lint Errors
SeverityLocationCodeMessage
Error/usr/arc/libphutil/src/auth/PhutilAuthAdapterRADIUS.php:106PHL1Unknown Symbol
Error/usr/arc/libphutil/src/auth/PhutilAuthAdapterRADIUS.php:107PHL1Unknown Symbol
Error/usr/arc/libphutil/src/auth/PhutilAuthAdapterRADIUS.php:113PHL1Unknown Symbol
Error/usr/arc/libphutil/src/auth/PhutilAuthAdapterRADIUS.php:117PHL1Unknown Symbol
Error/usr/arc/libphutil/src/auth/PhutilAuthAdapterRADIUS.php:122PHL1Unknown Symbol
Error/usr/arc/libphutil/src/auth/PhutilAuthAdapterRADIUS.php:134PHL1Unknown Symbol
Errorsrc/applications/auth/controller/PhabricatorEmailTokenController.php:54PHL1Unknown Symbol
Errorsrc/applications/calendar/view/AphrontCalendarMonthView.php:90PHL1Unknown Symbol
Errorsrc/applications/conpherence/controller/ConpherenceNotificationPanelController.php:75PHL1Unknown Symbol
Errorsrc/applications/differential/render/DifferentialChangesetHTMLRenderer.php:253PHL1Unknown Symbol
Errorsrc/applications/differential/view/DifferentialAddCommentView.php:189PHL1Unknown Symbol
Errorsrc/applications/differential/view/DifferentialInlineCommentView.php:233PHL1Unknown Symbol
Errorsrc/applications/differential/view/DifferentialLocalCommitsView.php:131PHL1Unknown Symbol
Errorsrc/applications/differential/view/DifferentialRevisionCommentView.php:90PHL1Unknown Symbol
Errorsrc/applications/differential/view/DifferentialRevisionUpdateHistoryView.php:205PHL1Unknown Symbol
Errorsrc/applications/diffusion/controller/DiffusionCommitController.php:747PHL1Unknown Symbol
Errorsrc/applications/diffusion/view/DiffusionCommentView.php:142PHL1Unknown Symbol
Errorsrc/applications/feed/builder/PhabricatorFeedBuilder.php:51PHL1Unknown Symbol
Errorsrc/applications/feed/controller/PhabricatorFeedDetailController.php:30PHL1Unknown Symbol
Errorsrc/applications/feed/controller/PhabricatorFeedListController.php:35PHL1Unknown Symbol
Errorsrc/applications/feed/controller/PhabricatorFeedPublicStreamController.php:28PHL1Unknown Symbol
Errorsrc/applications/herald/controller/HeraldTranscriptController.php:371PHL1Unknown Symbol
Errorsrc/applications/maniphest/controller/ManiphestTaskDescriptionPreviewController.php:21PHL1Unknown Symbol
Errorsrc/applications/maniphest/controller/ManiphestTaskDetailController.php:352PHL1Unknown Symbol
Errorsrc/applications/notification/controller/PhabricatorNotificationListController.php:48PHL1Unknown Symbol
Unit
No Test Coverage

Event Timeline

src/applications/chatlog/controller/PhabricatorChatLogChannelLogController.php
132

Is there a more efficient way to parse all messages in one go?

I think the linting errors are all due to the fact that I'm running patched/forked versions of arc and libphutil

btrahan requested changes to this revision.Dec 4 2013, 5:43 PM

Provided some inline feedback on getting more efficient here. Not sure if @epriestley had other thoughts about the diff tho.

src/applications/chatlog/controller/PhabricatorChatLogChannelLogController.php
132

Yeah, as is this is very inefficient. To fix, put something like this above this foreach loop

$engine = id(new PhabricatorMarkupEngine())
  ->setViewer($this->getUser());
$markup_objects = array();
foreach ($blocks as $index => $block) {
  $markup_object = id(new PhabricatorMarkupOneOff())
    ->setPreserveLinebreaks(true)
    ->setContent($block);
  $engine->addObject($markup_object, 'default');
  $markup_objects[$index] = $markup_object;
}
$engine->process();

and then where you do this renderOneObject thing, you'll need something like

$markup_objects = $markup_objects[$index];
$engine->getOutput($markup_object, 'default');

You'll have to augment the foreach so $index is in scope here too.

You can clear the phutil_tag_div() errors by updating libphutil. You can identify which copy of libphutil to update by examining the first few lines of any arc command with --trace (e.g., arc list --trace).

One quasi-problem with doing this is that stuff like macros will expand inline, which isn't necessarily intended, but I think the direction we're headed will probably see us interpret chat as remarkup with greater frequency. If you make the batch processing improvements @btrahan outlines, I think we can pull this safely.

It would be slightly more efficient to make the log events implement PhabricatorMarkupInterface, then batch them like @btrahan's inline. Since they're immutable, the key can be the log entry ID instead of requiring us to hash the text every time. This should be very minor compared to other performance considerations, however.

Is there such a thing as parsing profiles/parameters for remarkup, which would allow to parse specific things (PHIDs) but avoid macros, which are likely to be noise, since they were never seen in the original chat conversation?

There are, but we should avoid them for now since they're kind of built on the wrong dimension. The current profiles are per-application ("feed", "differential", "diffusion"), but these don't actually map well to use.

The right profiles are half-implemented, and are "html", "text", and probably "inline" (no images / huge block elements), which would be appropriate here. We can switch over to using that once that stuff is more robust. T2617 is sort of tracking this. We've gotten rid of most of the differences between the application-based profiles but haven't yet made the role-based profiles substantive.

More likely Conpherence v2 will see the demise of Chatlog.