1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-21 17:58:47 +02:00
Commit graph

1426 commits

Author SHA1 Message Date
Joshua Spence
427cc22149 Rename protocol adapter classes
Summary: Ref T5655. Rename protocol adapter classes to remove `Base` from the class name.

Test Plan: Unit tests still pass.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T5655

Differential Revision: https://secure.phabricator.com/D12563
2015-05-18 08:20:12 +10:00
epriestley
04186e02cf Separate handle "status" and "availability"
Summary:
Ref T7707. Handles currently have a "status" field and a "disabled" field.

The "status" field has these possible values: "open", "closed", "1", "2". durp durp durp

Instead, do:

  - status = <open, closed>
  - availability = <full, partial, none, disabled>

I think these make more sense? And are a bit more general? And use the same kind of constants for all values!

Test Plan: Looked at all affected handles in all states (probably).

Reviewers: chad, btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T7707

Differential Revision: https://secure.phabricator.com/D12832
2015-05-14 11:14:44 -07:00
Joshua Spence
61b178f44e Use PhutilInvalidStateException
Summary: Use `PhutilInvalidStateException`. Depends on D12803.

Test Plan: Unit tests pass.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D12829
2015-05-14 07:53:52 +10:00
Joshua Spence
acb45968d8 Use __CLASS__ instead of hard-coding class names
Summary: Use `__CLASS__` instead of hard-coding class names. Depends on D12605.

Test Plan: Eyeball it.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: hach-que, Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D12806
2015-05-14 07:21:13 +10:00
epriestley
3df64104de Use full URIs to link to objects from Phame blogs
Summary: Fixes T6299.

Test Plan: Viewed live blog, saw full URIs.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: johnny-bit, epriestley

Maniphest Tasks: T6299

Differential Revision: https://secure.phabricator.com/D12793
2015-05-11 11:11:25 -07:00
epriestley
75fc4e763a Don't trim remarkup corpora before summarizing
Summary:
Currently, lists like this:

```
  - a
  - b
  - c
```

...get trimmed before summarization and end up looking like this after summarization:

```
- a
  - b
  - c
```

This produces the summary artifacts (first item at wrong indent level):

{F399841}

Instead, don't trim. This produces better summaries.

Test Plan: Saw a better summary of a list.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D12794
2015-05-11 11:10:42 -07:00
Bob Trahan
99b4941c9a Conpherence - use some handle pools for Durable column perf
Summary:
Ref T7708.

This changes things to $viewer->loadHandles where applicable in the durable column render stack. I saw some big wins on my test data like 34 queries => 24 queries on a newly created room as my default thread.

For my test data, the next big perf win would be to change how remarkup rendering works and try to multiload all objects of a certain type in one shot.
e.g. `PhabricatorEmbedFileRemarkupRule` implements `loadObjects` as do all classes which inherit from `PhabricatorObjectRemarkupRule`. This is because `PhabricatorObjectRemarkupRule` implements its `didMarkupText` method using `loadObjects`, and `didMarkupText` gets called per transaction over in `PhabricatorMarkupEngine->process()`. Instead, the `loadObjects` in `didMarkupText` should be hitting some cache, and we should do a bulk load for all `PhabricatorEmbedFileRemarkupRule` that had matches earlier in the rendering stack.  ...I think.

Test Plan: carefully looked at "Services" tab in dark console and noted fewer queries with changes post changes versus pre changes

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T7708

Differential Revision: https://secure.phabricator.com/D12780
2015-05-08 18:14:04 -07:00
epriestley
dd88a0e9e9 Clean up miscellaneous bot issues
Summary:
Fixes T6073. Fixes T7775. Ref T4377. This fixes a few easy things without any compatibility-breaking changes.

  - Stop matching things like `:D123` as a revision (particularly: IPv6 addresses).
  - Use "diffusion.querycommits".
  - Support "conduit.token".

Test Plan:
Used a token:

```
[07:52am] epriestley: -D22 :D22 #D22 /D22
[07:52am] epriestley: D22
[07:52am] phabot-local: D22: asdbb - http://local.phacility.com/D22
[07:54am] epriestley: rHGTESTX6518697472d6395f5d1cec557148957734aa76c2
[07:54am] phabot-local: http://local.phacility.com/rHGTESTX6518697472d6395f5d1cec557148957734aa76c2
```

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T7775, T6073, T4377

Differential Revision: https://secure.phabricator.com/D12773
2015-05-08 12:20:44 -07:00
epriestley
7c96ba4ced Fix another "reply" issue with inlines showing up on the wrong side
We can just trust the "reply" value on the server, since inlines never port from old to new or vice versa.

Auditors: btrahan
2015-05-08 07:06:58 -07:00
epriestley
7556a70280 Prevent Files from requiring infinite policy checks
Summary:
Fixes T6726. Currently, a file may be attached to itself (or to other files, ultimately forming a loop). In this case, we currently run around the loop forever trying to load all the files.

Instead, decline to load objects if we're inside a query which is already loading them. This produces the right policy result //and// completes in finite time.

Test Plan:
  - Looped two files by writing `{F123}` and `{F124}` on the other files, respectively.
  - Loaded `F123`.
  - Saw long hang; used `debug.time-limit` to see huge stack trace instead.
  - Wrote patch.
  - `F123` now loads correctly.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T6726

Differential Revision: https://secure.phabricator.com/D12756
2015-05-07 15:58:35 -07:00
lkassianik
7fd401d0e0 First stab at Calendar day view sidebar
Summary: Ref T4393, First stab at Calendar day view sidebar

Test Plan: Open Calendar day view, sidebar should show today and the next 6 days, empty or not.

Reviewers: epriestley, #blessed_reviewers, chad

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Maniphest Tasks: T4393

Differential Revision: https://secure.phabricator.com/D12742
2015-05-06 18:41:48 -07:00
epriestley
31a89bb94d Revert a json_decode() which decodes possible scalars
See D12714, D12680.

Auditors: joshuaspence
2015-05-05 11:08:32 -07:00
Joshua Spence
8d128646b3 Fix a lisk issue
Summary:
This was broken in D12680.

```
EXCEPTION: (PhutilJSONParserException) Parse error on line 0 at column 0: 'null' is not a valid JSON object. at [<phutil>/src/parser/PhutilJSONParser.php:41]
  #0 PhutilJSONParser::parse(string) called at [<phutil>/src/utils/utils.php:1062]
  #1 phutil_json_decode(string) called at [<phabricator>/src/infrastructure/storage/lisk/LiskDAO.php:1640]
  #2 LiskDAO::applyLiskDataSerialization(array, boolean) called at [<phabricator>/src/infrastructure/storage/lisk/LiskDAO.php:1386]
  #3 LiskDAO::willReadData(array) called at [<phabricator>/src/infrastructure/storage/lisk/PhabricatorLiskDAO.php:214]
  #4 PhabricatorLiskDAO::willReadData(array) called at [<phabricator>/src/infrastructure/storage/lisk/LiskDAO.php:608]
  #5 LiskDAO::loadFromArray(array) called at [<phabricator>/src/infrastructure/storage/lisk/LiskDAO.php:652]
  #6 LiskDAO::loadAllFromArray(array) called at [<phabricator>/src/applications/transactions/query/PhabricatorApplicationTransactionQuery.php:62]
  #7 PhabricatorApplicationTransactionQuery::loadPage() called at [<phabricator>/src/infrastructure/query/policy/PhabricatorPolicyAwareQuery.php:227]
  #8 PhabricatorPolicyAwareQuery::execute() called at [<phabricator>/src/infrastructure/query/policy/PhabricatorCursorPagedPolicyAwareQuery.php:143]
  #9 PhabricatorCursorPagedPolicyAwareQuery::executeWithCursorPager(AphrontCursorPagerView) called at [<phabricator>/src/applications/base/controller/PhabricatorController.php:577]
  #10 PhabricatorController::buildTransactionTimeline(PhabricatorPaste, PhabricatorPasteTransactionQuery) called at [<phabricator>/src/applications/paste/controller/PhabricatorPasteViewControll
```

Test Plan: No exception shown.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D12714
2015-05-05 22:10:45 +10:00
Joshua Spence
e225998fce Remove "commit hook mode" check from Javelin linter
Summary: Ref T7674. Commit hook mode is going away.

Test Plan: Eyeball it.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T7674

Differential Revision: https://secure.phabricator.com/D12712
2015-05-05 21:10:26 +10:00
Joshua Spence
70c8649142 Use phutil_json_decode instead of json_decode
Summary: Generally, `phutil_json_decode` should be preferred over `json_decode`.

Test Plan: Eyellballed.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D12680
2015-05-05 20:48:55 +10:00
Bob Trahan
f83e12c943 Add missing typehint
Summary: Ref D12694.

Test Plan: no more error in the logs

Reviewers: epriestley, joshuaspence

Reviewed By: joshuaspence

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D12709
2015-05-04 15:13:40 -07:00
Joshua Spence
4ea9d76f66 Add some missing type hints
Summary: Add some typehints for Remarkup rules.

Test Plan: Browsed around some Remarkup text.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D12694
2015-05-05 07:33:00 +10:00
Joshua Spence
6bebb3c69a Add "and" support to "ref"
Summary: Fixes T8038. Allow `PhabricatorCustomFieldMonogramParser` to handle "and". This means that `Ref Tx, Ty and Tz` will correctly return `array('monograms' => array('Tx', 'Ty', 'Tz')`.

Test Plan: Added unit tests.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley

Maniphest Tasks: T2, T3, T1, T8038

Differential Revision: https://secure.phabricator.com/D12682
2015-05-05 07:14:15 +10:00
epriestley
9c7d1b0b90 Highlight cell when jumping to an inline comment
Summary: Fixes T8061.

Test Plan: {F392321}

Reviewers: chad

Reviewed By: chad

Subscribers: epriestley

Maniphest Tasks: T8061

Differential Revision: https://secure.phabricator.com/D12705
2015-05-04 12:21:21 -07:00
Chad Little
861155ea73 Remove click to view on ghosties
Summary: Ref T7447, these are more work than needed at least on an indivdual basis. JS openning all feels poor as well.

Test Plan: Review comments, past present and future.

Reviewers: btrahan, epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T7447

Differential Revision: https://secure.phabricator.com/D12702
2015-05-04 11:59:04 -07:00
Bob Trahan
7aac1effac Projects - publish feed stories for project edits
Summary: Fixes T7426. Wasn't 100% sure what the right feed notify phids were so I went with project subscribers.

Test Plan: made a project and saw the "btrahan created $project" story. edited project members and hashtags and got proper stories.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T7426

Differential Revision: https://secure.phabricator.com/D12649
2015-05-01 17:34:43 -07:00
epriestley
7b6c320e15 Skeleton for "Multimeter", a performance sampling application
Summary:
Ref T6930. This application collects and displays performance samples -- roughly, things Phabricator spent some kind of resource on. It will collect samples on different types of resources and events:

  - Wall time (queries, service calls, pages)
  - Bytes In / Bytes Out (requests)
  - Implicit requests to CSS/JS (static resources)

I've started with the simplest case (static resources), since this can be used in an immediate, straghtforward way to improve packaging (look at which individual files have the most requests recently).

There's no aggregation yet and a lot of the data isn't collected properly. Future diffs will add more dimension data (controllers, users), more event and resource types (queries, service calls, wall time), and more display options (aggregation, sorting).

Test Plan: {F389344}

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T6930

Differential Revision: https://secure.phabricator.com/D12623
2015-05-01 13:19:43 -07:00
Chad Little
94299c0a6b Minor tweaks to inline comments
Summary: Ref T7447, Ref T1460. Moves "done" state to left, and no longer is a button (simpler CSS). Also feels a little nicer. Clean up some spacing issue with Ghosties.

Test Plan:
Test new and old comments, as author and reviewer.

{F389986}

{F389987}

{F389988}

Reviewers: btrahan, epriestley

Reviewed By: epriestley

Subscribers: aik099, Korvin, epriestley

Maniphest Tasks: T1460, T7447

Differential Revision: https://secure.phabricator.com/D12641
2015-05-01 07:06:02 -07:00
Chad Little
68c113832e Collapse previous/forward by default, click to expand.
Summary: This is a lighter UI treatment for previous/forward comments, where the comment is just hidden behind a click. This mayyy be too hard to discover, but I'd rather wait and make it more obvious if actually needed. Once you understand the interaction, the cleaner UI is preferable. Ref T7447

Test Plan:
Test a lot of previous and forward comments.

{F389658}

Reviewers: btrahan, epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T7447

Differential Revision: https://secure.phabricator.com/D12627
2015-04-30 11:20:29 -07:00
epriestley
f3a2d2b020 Restore missing ApplicationSearch join clause for Maniphest
Summary: See IRC. This got dropped in the order refactoring.

Test Plan: Ordered Maniphest search results by a custom field.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D12614
2015-04-29 13:28:48 -07:00
lkassianik
75408d1381 Calendar event monograms, part 3. Remarkup for calendar event monograms.
Summary: Ref T7928, Calendar event monograms, part 3. Remarkup for calendar event monograms.

Test Plan: Create calendar event, open a maniphest task, add 'E{id}' and preview should show a hovertag for event that links to event.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Maniphest Tasks: T7928

Differential Revision: https://secure.phabricator.com/D12580
2015-04-27 14:27:34 -07:00
epriestley
fad75f939d Improve messaging around repository locks
Summary:
Fixes T6958. Ref T7484.

  - When we collide on a lock in `bin/repository update`, explain what that means.
  - GlobalLock currently uses a "lock name" which is different from the lock's actual name. Don't do this. There's a small chance this fixes T7484, but I don't have high hopes.

Test Plan: Ran `bin/repository update X` in two windows really fast, got the new message in one of them.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T6958, T7484

Differential Revision: https://secure.phabricator.com/D12574
2015-04-27 10:25:53 -07:00
root
1ab6ad3ee8 Add link custom field.
Summary: Ref T3868. Adds a link custom field that verifies and links to the text provided.

Test Plan: Add a custom field with type "link", then enter a well-formed URL in the provided box in the edit task screen. Verify that the URL displays correctly on the task display page.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Maniphest Tasks: T3868

Differential Revision: https://secure.phabricator.com/D12543
2015-04-24 11:49:11 -07:00
epriestley
22e3e35418 Move ManiphestTaskQuery to EdgeLogic
Summary:
Ref T4100. Share all edge logic code across applications.

  - Internalizes the "check that the viewer can see projects" check into edge logic.
  - Adds some convenience functions. Some of these aren't really all that convenient, but it's rare that we actually apply project constraints to queries in the applications -- and most of these callsites will go away in the long term -- so I didn't go too crazy with providing a simpler `withProjectPHIDs()` universal API or anything.

Test Plan:
  - Grepped for all affected symbols.
  - Tried to violate policies.
  - Used workboards.
  - Used normal Maniphest queries.
  - Used `maniphest.query`.
  - Verified the special grouping behavior works as expected.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T4100

Differential Revision: https://secure.phabricator.com/D12526
2015-04-23 11:49:33 -07:00
epriestley
c596c358db Make "Reply" on ghost inlines work correctly (or, at least, consistently)
Summary:
Ref T7447. Ref T7870. When you "reply" to a ghost inline, make it work properly.

This exact behavior is arguable. In particular, when you reply to a ghost inline, we //could// put the reply on the same diff as the original.

I suspect it aligns better with user exepectation to put the new inline on the current (visible) diff instead, and generally for inlines to flow forward through time and all of the ghosts to pretty much be older than all of the non-ghosts in most cases. We can see how it feels and adjust things if this turns out to not make sense.

Test Plan:
  - Replied to ghost inlines, got new inlines on the proper display line.
  - Replied to normal inlines, got normal behavior.
  - Made some new inlines.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T7870, T7447

Differential Revision: https://secure.phabricator.com/D12492
2015-04-21 11:06:44 -07:00
epriestley
fe774e68e2 Distinguish between ported-forward and ported-backward comments
Summary:
Ref T7447. This might be overkill, but I want to over-explain things until we have more confidence that this is rarely confusing.

NOTE: I'm playing it a bit fast and loose with `setIsGhost()` (passing a dictionary) because making API changes requires changing the interface and Diffusion, which is a pain. I'll clean this up at the end once the interface is more final. This is well-contained for now.

Test Plan:
  - Viewed "base vs 2" in a diff with 3 diffs, saw some "older comments" and some "newer comments".
  - Hovered the tags for an explanation of comment spookiness.

{F377703}

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T7447

Differential Revision: https://secure.phabricator.com/D12490
2015-04-21 11:06:44 -07:00
epriestley
b2d280ff51 Port comments through time and space in the common/best case
Summary:
Ref T7447. This ports comments forward and backward in the best case:

  - The old comment is on a changeset with the same filename.
  - The old and new files are pretty much the same, line-for-line.

This will fail to port a lot of comments around and probably port a lot of comments into goofy places. We can see how bad it is in practice.

Errata:

  - Design is me cobbling something together, probably worth tweaking.
  - "Old Comment" should, at a minimum, say "Newer Comment" sometimes, or we should come up with some better name for this stuff.

Test Plan: {F377214}

Reviewers: chad, btrahan

Reviewed By: btrahan

Subscribers: johnny-bit, yelirekim, epriestley

Maniphest Tasks: T7447

Differential Revision: https://secure.phabricator.com/D12484
2015-04-21 11:06:44 -07:00
epriestley
4005bff567 Implement function-driven logical project queries in Differential
Summary:
Ref T4100. Ref T5595. This implements these fields in one mega-field:

  - Projects
  - Not in projects
  - In any project
  - Include results in no projects
  - In users' projects

Hopefully, this is a step in the right direction.

Test Plan: {F375555}

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: joshuaspence, chad, epriestley

Maniphest Tasks: T4100, T5595

Differential Revision: https://secure.phabricator.com/D12463
2015-04-20 10:06:21 -07:00
epriestley
e27c0b416d Add "Edge Logic" support to PolicyAwareQuery
Summary:
Ref T4100. Ref T5595. This allows PolicyAwareQuery to write all the logic for AND, OR, NOT, and NULL (i.e., "not in any projects") queries against any edge type.

It accepts an edge type and a list of constraints (which are basically just operator-value pairs, like `<NOT, PHID-X-Y>`, meaning the results must not have an edge connecting them to `PHID-X-Y`).

This doesn't actually do anything yet; see future diffs.

Test Plan: `arc unit --everything`

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T4100, T5595

Differential Revision: https://secure.phabricator.com/D12455
2015-04-20 10:06:12 -07:00
epriestley
55e49d7e31 Provide more buildXClause() and buildXClauseParts() on PolicyAwareQuery
Summary:
Ref T4100. Ref T5595. These functions are trivial for now, but move us toward being able to define more default query behavior by default.

Future changes will give these methods meaningful, nontrivial behaviors.

Test Plan: `arc unit --everything`

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T5595, T4100

Differential Revision: https://secure.phabricator.com/D12454
2015-04-20 10:06:10 -07:00
epriestley
f5580c7a08 Make buildWhereClause() a method of AphrontCursorPagedPolicyAwareQuery
Summary:
Ref T4100. Ref T5595.

To support a unified "Projects:" query across all applications, a future diff is going to add a set of "Edge Logic" capabilities to `PolicyAwareQuery` which write the required SELECT, JOIN, WHERE, HAVING and GROUP clauses for you.

With the addition of "Edge Logic", we'll have three systems which may need to build components of query claues: ordering/paging, customfields/applicationsearch, and edge logic.

For most clauses, queries don't currently call into the parent explicitly to get default components. I want to move more query construction logic up the class tree so it can be shared.

For most methods, this isn't a problem, but many subclasses define a `buildWhereClause()`. Make all such definitions protected and consistent.

This causes no behavioral changes.

Test Plan: Ran `arc unit --everything`, which does a pretty through job of verifying this statically.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: yelirekim, hach-que, epriestley

Maniphest Tasks: T4100, T5595

Differential Revision: https://secure.phabricator.com/D12453
2015-04-20 10:06:09 -07:00
epriestley
9437414f17 Improve browsability of Almanac service datasource query
Summary: Ref T5750. Update the Almanac service query to be browsable.

Test Plan:
  - Browsed and reordered Diffusion.
  - Browsed and reordered services in Almanac.

{F373735}

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T5750

Differential Revision: https://secure.phabricator.com/D12433
2015-04-17 11:06:57 -07:00
epriestley
8efdc4aabf Replace getPagingValue() with cursor methods
Summary:
Ref T7803. Prior to this change sequence, Query classes conflated paging values (the actual thing that goes in a "x > 3" clause) with cursor values (arbitrary identifiers which track where the user is in a result list).

Although the two can sometimes be the same, the vast majority of implementations are simpler and better when object IDs are used as cursors and paging values are derived from them.

The new stuff handles this in a consistent way, so we're free to separate getPagingValue() from paging. The new method is essentially getResultCursor().

This also implements getPageCursors(), which allows queries to return directional cursors. The inability to do this was a practical limitation blocking the implementation of T7803.

Test Plan:
  - Browsed a bunch of results and paged through queries.
  - Grepped for removed methods.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T7803

Differential Revision: https://secure.phabricator.com/D12383
2015-04-13 11:58:38 -07:00
epriestley
6e4f508beb Provide "builtin" high-level result orders
Summary:
Ref T7803. Currently, available high-level orders are spread across Query and SearchEngine classes and implemented separately for each application.

Lift the concept of "builtin" (high-level, user-facing, named) orders (similar to "builtin" queries in ApplicationSearch) into the root Query class, and let it drive the SearchEngine implementation. This allows you to define a new order in one place and have it automatically work across the entire stack.

This will also let Conduit expose this information in a straightforward way.

Test Plan:
  - Used ApplicationSearch in Diffusion.
  - Used all result orderings.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T7803

Differential Revision: https://secure.phabricator.com/D12379
2015-04-13 11:58:34 -07:00
epriestley
2794c69db5 Remove getPagingColumn() / getReversePaging()
Summary: Ref T7803. Remove these in favor of more generalized paging and ordering.

Test Plan: Sorted and paged results in various applications.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T7803

Differential Revision: https://secure.phabricator.com/D12378
2015-04-13 11:58:32 -07:00
epriestley
bdd1edea7a Modernize ManiphestTask paging and ordering
Summary:
Ref T7803. The ApplicationSearch integration is still a little rough here, but it seems to have the correct behavior.

The rest of this is now at least relatively sane, cohesive, and properly behaved.

Test Plan:
  - Used all grouping and ordering queries in Maniphest. Pagingated results.
  - Used custom field ordering in Maniphest. Paginated results.
  - Paginated through the `null` section of "Assigned" and "Projects" group-by queries. Pagingation now works correctly (it does not work at HEAD).
  - Ran unit tests covering priority changes.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T7803

Differential Revision: https://secure.phabricator.com/D12372
2015-04-13 11:58:31 -07:00
epriestley
4114560844 Modernize more paging/order queries
Summary:
Ref T7803. Removes some getReversePaging().

This also fixes `null` column handling, by adding an explicit `'null'` key with possible values "head" (put NULL before other values) or "tail" (put NULL after other values).

Maniphest has some glitchiness in paging through NULLs right now, but I believe it's all pre-existing and will be resolved when it fully converts. Diffusion is fully converted and pages through NULL correctly.

Test Plan:
  - Failed to identify any reason for ChangesetQuery to reverse paging.
  - Paged thorugh Diffusion.
  - Paged through Maniphest.
    - Maniphest has some issues when paging inside a NULL section, but these issues are preexisting and will be resolved later in this change sequence.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T7803

Differential Revision: https://secure.phabricator.com/D12371
2015-04-13 11:58:30 -07:00
epriestley
9c7c13ffc8 Modernize Phrequent and Commit query ordering/paging
Summary: Ref T7803. Fixes T3870. Move these away from pagingColumn / reversePaging.

Test Plan:
  - Tested/paged audit query.
  - Poked at Phrequent. Didn't seem any more broken than before.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T3870, T7803

Differential Revision: https://secure.phabricator.com/D12363
2015-04-13 11:58:29 -07:00
epriestley
e0fa0fbdee Modernize Phriction ordering/paging
Summary: Ref T7803. Fixes T7809. Move Phriction away from getReversePaging() / getPagingColumn().

Test Plan: Paged "All Documents", "Updated", and viewed document hierarchy.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: ite-klass, epriestley

Maniphest Tasks: T7809, T7803

Differential Revision: https://secure.phabricator.com/D12360
2015-04-13 11:58:25 -07:00
epriestley
a4a198342e Modernize ReleephProjectQuery ordering/paging
Summary: Ref T7803. Continue removing implementations of getPagingColumn() and getReversePaging().

Test Plan: Browsed and paged through Releeph projects, Maniphest tasks, Diffusion repositories.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T7803

Differential Revision: https://secure.phabricator.com/D12358
2015-04-13 11:58:21 -07:00
epriestley
4fba6e7730 Remove trivial implementations of getPagingColumn()
Summary:
Ref T7803. Some Query subclasses implement getPagingColumn() in a trivial way, usually to provide a table alias.

Formalize the concept of a primary table alias, and remove obsoleted getPagingColumn() implementations.

Test Plan: Issued affected queries.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T7803

Differential Revision: https://secure.phabricator.com/D12356
2015-04-13 11:58:19 -07:00
epriestley
a40c40fade Drive query ordering and paging more cohesively
Summary:
Ref T7803. Ordering and paging are inherently intertwined, but they often aren't driven by the same data right now.

Start driving them through the same data:

  - `getOrderableColumns()` defines orderable and pageable columns.
  - `getPagingValueMap()` reads values from a cursor.

This is generally sufficient to implement both paging and ordering.

Also, add some more sanity checks to try to curtail the number of ambiguous/invalid orderings applications produce, since these cause subtle/messy bugs.

Test Plan:
  - Paged through pastes and a few other object types.
  - Intentionally changed defaults to be invalid and hit some of the errors.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T7803

Differential Revision: https://secure.phabricator.com/D12355
2015-04-13 11:58:18 -07:00
epriestley
604d1409f1 Make buildPagingClauseFromMultipleColumns() safer
Summary: Ref T7803. Reduce the amount of code we're trusting to build SQL queries.

Test Plan:
  - Paged through results in Maniphest, Differential and Diffusion.
  - Some of the NULLable groups in Maniphest are a bit funky but this was preexisting.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T7803

Differential Revision: https://secure.phabricator.com/D12353
2015-04-13 11:58:15 -07:00
epriestley
a43473c4b6 Begin formalizing query orders
Summary:
Ref T7803. Queries currently have a single `getPagingColumn()`, which is oversimplified and insufficient to describe many ordering operations. Frequently, orders must span multiple columns.

Move toward an "order vector", which is a list of orderable values like "name, id". These map directly to columns, and are sufficient to actually describe orders. The more modern Query classes (Maniphest, Repository) essentially do this manually anyway.

Test Plan:
  - Added and executed unit tests.
  - Browsed around, verified the correct ORDER BY clauses were generated.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T7803

Differential Revision: https://secure.phabricator.com/D12352
2015-04-13 11:58:14 -07:00
epriestley
9dc114d115 Make formatOrderClause() safer
Summary:
Ref T7803. Instead of trusting subqueries to provide safe values, escape them explicitly.

(We'll probably have a few cases somewhere where this doesn't work, but can make them the exception rather than the rule.)

Test Plan: Issued all "order" queries in Diffusion.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T7803

Differential Revision: https://secure.phabricator.com/D12351
2015-04-13 11:58:13 -07:00