Page MenuHomePhabricator

Truncate long source lines in Paste search result list snippets
ClosedPublic

Authored by gd on Oct 20 2015, 4:30 PM.

Details

Summary

An attempt to resolve T9600.

  • PhabricatorPasteQuery builds truncated snippet when requested using needSnippet().
  • PhabricatorPasteSearchEngine uses Paste snippet istead of content.
  • PhabricatorSourceCodeView accepts truncated source and type instead of line limit.
Test Plan

Generated some content for Paste application and also added huge JSON oneliner. Checked Paste application pages in browser.

Diff Detail

Repository
rP Phabricator
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

gd updated this revision to Diff 34550.Oct 20 2015, 4:30 PM
gd retitled this revision from to Truncate long source lines in Paste search result list snippets.
gd updated this object.
gd edited the test plan for this revision. (Show Details)
gd added a reviewer: epriestley.
epriestley accepted this revision.Oct 20 2015, 4:38 PM
epriestley edited edge metadata.

Seems reasonable as a step forward to me, thanks! A couple minor inlines. You should have commit access now.

src/applications/paste/query/PhabricatorPasteQuery.php
51

For consistency, prefer needSnippets() over needSnippet() (i.e., plural) -- Query classes load multiple objects in the general case.

292

Prefer phutil_json_decode().

328

Prefer phutil_json_encode().

This revision is now accepted and ready to land.Oct 20 2015, 4:38 PM
This revision was automatically updated to reflect the committed changes.
gd marked 3 inline comments as done.