1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 08:52:39 +01:00
Commit graph

9978 commits

Author SHA1 Message Date
epriestley
f044c1e999 Possibly fix issue with subpriority recursion
Summary:
Ref T7664. Currently, when spreading subpriorities we may recurse deeply in certain conditions. Make sure we never recurse more than one level.

To try to mitigate issues with floating point precision, be more aggressive about selecting tasks to reorder.

I wasn't really able to come up with a realistic test case here, and the test cases I found which sort of approximated the behavior took way too long to generate data to actually commit.

This approach is inherently somewhat fragile but hopefully this is approximately good enough. We don't have a durable storage engine which can meaningfully represent double-linked lists right now.

Test Plan:
  - Wrote some (slow) tests which kind of approximately hit the issue.
  - Verified they maxed out at stack depth 2 after the change.
  - Unit tests still pass.
  - Dragged some tasks around.
  - Couldn't come up with any pathological issues here by thinking about it?

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T7664

Differential Revision: https://secure.phabricator.com/D12511
2015-04-22 16:48:56 -07:00
epriestley
b5b8d0982c Make "Current Application" imply "Open documents in..."
Summary: This is probably consistent with user intent like 95% of the time, let's try making it default and documenting it.

Test Plan: Searched in "Current Application" in Maniphest.

Reviewers: chad

Reviewed By: chad

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D12512
2015-04-22 16:34:43 -07:00
epriestley
b49645d25b Use a typeahead for "document types" in global search
Summary:
  - Now that we have "browse", this is a much more reasonable control for random sets of things.
  - The new explicit search scope selector reduces the need to fiddle with this field manually, too.

Test Plan:
{F379292}

{F379293}

Reviewers: chad, btrahan

Reviewed By: btrahan

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D12510
2015-04-22 15:25:34 -07:00
epriestley
3a2c2ae3c3 Implement a scope selector for the global search
Summary:
See M1433. Fixes T7266. Fixes T4475. Ref T7314.

Future work/notes/etc:

  - Write the User Guide (see TODO).
  - This might needs some design tweaks -- I think it's functionally almost-equivalent to the mock, but the UI isn't quite the same.
  - (Mobile design is a touch off-looking I think?)
  - When you use a custom query, the duplicate "magnifying glass" icons are a little weird. Maybe change one or the other.
  - Maybe worth adding an "Open Documents in Current Application" option? Planning to wait for feedback on that.
  - Need a Quicksand integration to change the current application at some point.
  - Searching in "Current Application" from, e.g., the 404 page just searches all documents. Current plan is to just document this behavior, since the icon is a pretty good callout and it seems plausible that this is intuitive enough that users won't have a hard time with it.

Test Plan:
New dropdown:

{F379150}

Device-ish:

{F379151}

Normal search (current application, from maniphest, selects tasks):

{F379153}

Application search from non-application:

{F379154}

Reviewers: btrahan, chad

Reviewed By: chad

Subscribers: johnny-bit, epriestley

Maniphest Tasks: T7266, T7314, T4475

Differential Revision: https://secure.phabricator.com/D12509
2015-04-22 14:31:36 -07:00
epriestley
d8b4f32d04 Add a "remove projects" action to Herald
Summary: Fixes T7849. This adds "Remove Projects" to all objects which implement `PhabricatorProjectInterface`.

Test Plan:
  - Wrote a rule to remove a project, edited task, saw the project removed.
  - Admired entirely reasonable implementation complexity.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T7849

Differential Revision: https://secure.phabricator.com/D12505
2015-04-22 14:01:44 -07:00
epriestley
959e9d9ac2 Automatically support "Add Projects" in Herald for all relevant objects
Summary: Ref T7849. If the adapted object implements `PhabricatorProjectInterface`, support the ADD_PROJECTS action.

Test Plan:
  - Wrote a Differential rule with "Add Projects".
  - Updated a revision.
  - Got projects added.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T7849

Differential Revision: https://secure.phabricator.com/D12504
2015-04-22 14:01:32 -07:00
epriestley
501630d931 Make adding projects a standard Herald effect
Summary: Ref T7849. Lift project actions into the base class. Some day they'll be fully modular.

Test Plan:
  - Wrote an "add projects" Herald rule.
  - Edited Maniphest tasks.
  - Got projects added.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T7849

Differential Revision: https://secure.phabricator.com/D12503
2015-04-22 14:01:21 -07:00
epriestley
4e47e3a116 Merge redundant Herald effect code
Summary: Ref T7849. Lift more action handling out of adapters. In theory, adapters will some day do no action handling. That day is not today, but it is now a step closer.

Test Plan:
  - Wrote a rule using the email and flag actions.
  - Ran that rule.
  - Got an email and flag.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T7849

Differential Revision: https://secure.phabricator.com/D12502
2015-04-22 14:00:44 -07:00
Bob Trahan
2e8649c292 Conpherence - sort participant list in a case insensitive way
Summary: Fixes T7857. Some sorting gymnastics - make a nice list for natcasesort and then array_select_key to sort - but nothing too crazy.

Test Plan: made a room with user "btrahan" and other users "BTRAHA", "BTRAHANCAPS", and "xerxes". chat room correctly ordered "btrahan" (since logged in user always at top), "BTRAHA", "BTRAHANCAPS", "xerxes". Viewed room as "xerxes" and saw ordering "xerxes", "BTRAHA", "btrahan", "BTRAHANCAPS".

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T7857

Differential Revision: https://secure.phabricator.com/D12507
2015-04-22 12:19:24 -07:00
Chad Little
306ab29259 Add documentation for customizing fonts
Summary: Fixes T7888, adds clarification of property and an example.

Test Plan: Read the text, copy/paste example.

Reviewers: btrahan, epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T7888

Differential Revision: https://secure.phabricator.com/D12508
2015-04-22 12:13:11 -07:00
Bob Trahan
688c506ecf Quicksand - update help appropriately as you navigate about
Summary: Fixes T7724. Things are a bit tricky here as sometimes we don't want to display the help icon at all...! Change things such that we always render at least the icon, though it may have the style set to hidden if appropriate. Instrument quicksand javascript to then load the proper help dropdown if it can. Do this generally so other aphlict dropdowns could work pretty easily.

Test Plan: started on home and noted no help. clicked maniphest and saw maniphest help. clicked home and saw no help again. clicked differential and saw differential help.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T7724

Differential Revision: https://secure.phabricator.com/D12499
2015-04-22 12:05:27 -07:00
epriestley
e7702acdc6 Don't escape quotation marks when printing the monospaced CSS rule
Summary:
Fixes T7888. This is currently safe, but double quotes are incorrectly escaped.

To keep them unescaped, we have to punch through PhutilSafeHTML a bit. Since the allowable characters are strictly filtered this is still safe in practice, just not as theoretically-safe.

Test Plan: Set font to `32px "impact"` (with quotes), saw impact font.

Reviewers: btrahan, chad

Reviewed By: chad

Subscribers: epriestley

Maniphest Tasks: T7888

Differential Revision: https://secure.phabricator.com/D12506
2015-04-22 09:28:35 -07:00
epriestley
4dea152215 Fix a possible undefined variable
Summary: Fixes T7881.

Test Plan: Inspection.

Reviewers: btrahan, joshuaspence

Reviewed By: joshuaspence

Subscribers: epriestley

Maniphest Tasks: T7881

Differential Revision: https://secure.phabricator.com/D12500
2015-04-21 19:28:43 -07:00
Chad Little
1fbcfb79df Leafy Greens 2015-04-21 15:48:35 -07:00
Bob Trahan
dd9ec255ec Quicksand - make notification and message counts update as you navigate around
Summary: Ref T7573. Unify code to fetch these counts and do some light formatting since we're going to need to do the same thing for some conpherence-specific ajax in the durable column (See T7708).

Test Plan: loaded up two tabs, one with a durable column on and one without. in the without browser, i read some messages, decrementing my unread count. when i navigated again in the durable column browser, the count updated correctly. with no notifications, commented on a task with another user to get a notification and it showed up properly. visited the task by clicking not the notification and the bubble count decremented correctly

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T7573

Differential Revision: https://secure.phabricator.com/D12498
2015-04-21 15:46:36 -07:00
epriestley
c509e80a74 Fix an issue where versus diffs tried to load invalid changeset IDs
Auditors: btrahan
2015-04-21 15:38:52 -07:00
epriestley
1858d2aa66 Make Differential timeline aware of ghostly inlines
Summary:
Ref T7447. Ref T7870.

When a ghostly inline appears on the page, the timeline isn't currently aware that it's present, so it links elsewhere.

Instead, apply adjustments before rendering the timeline.

Ref T5030. This makes the behaviors in T5030 irrelevant most of the time.

Test Plan:
Before:

{F378106}

After:

  - Inlines visible on page are linked directly.
  - Inlines which we can't port (e.g., on files not present on current page) are still linked off-page.
  - Used "Show Older" to page through and verify consistent rendering.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: yelirekim, epriestley

Maniphest Tasks: T5030, T7870, T7447

Differential Revision: https://secure.phabricator.com/D12497
2015-04-21 15:32:23 -07:00
epriestley
d8bd3efa2c Simplify timeline rendering on Differential revisions
Summary: Ref T7447. Remove the `loadInlineComments()` by-ref side-effect mess and make this load more direct.

Test Plan:
  - Viewed a revision.
  - Clicked "Show Older".

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T7447

Differential Revision: https://secure.phabricator.com/D12496
2015-04-21 15:31:43 -07:00
epriestley
a4a65bd5f1 Let ghostly inlines automatically expand changesets in enormous diffs
Summary:
Ref T7447. Ref T7870. When a diff affects more than 100 files, we collapse files by default, then expand files with inlines.

Ghostly inlines currently don't cause files to expand, but reasonably should.

Test Plan:
Before:

{F378065}

After:

{F378066}

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: yelirekim, epriestley

Maniphest Tasks: T7447, T7870

Differential Revision: https://secure.phabricator.com/D12495
2015-04-21 15:31:18 -07:00
epriestley
8c39885076 Track ghostly inlines across file moves
Summary:
Ref T7447. Ref T7870.

  - Forward: When rendering some file "B" which was moved from "A", port ghosts for both "A" and "B" to it.
  - Backward: When porting a comment on "X" which was moved from some "Y", allow it to port to a file named "Y" if it can't find a file named "X".

Test Plan:
Before:

{F377809}

After:

{F377806}

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T7447, T7870

Differential Revision: https://secure.phabricator.com/D12493
2015-04-21 11:06:44 -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
84f62bdf9a Move ported inlines which appear on nonvisible lines backward so they show up
Summary:
Ref T7447. Ref T7870. See T7870 for a detailed description of this issue.

NOTE: Replying to these inlines from the UI still does the wrong thing, because we use the database line number, not the UI line number.

Test Plan:
Before:

{F377732}

After:

{F377733}

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T7447, T7870

Differential Revision: https://secure.phabricator.com/D12491
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
aa04e97de7 Prefer left-side for old comments in new-vs-new diff of diffs
Summary: Ref T7447. Ref T7870.

Test Plan:
Before:

{F377691}

After:

{F377692}

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T7870, T7447

Differential Revision: https://secure.phabricator.com/D12489
2015-04-21 11:06:44 -07:00
epriestley
b74bb0019e Filter nonvisible inlines out of changeset inline result set
Summary:
Ref T7447. After compiling inlines which will appear on the changeset, remove inlines which

Later stages remove these anyway, so it doesn't change anything to keep them around, but we can filter them out here cheaply.

This will also let us drive the Differential timeline view with the same logic a few diffs from now, to improve how it renders inlines. Generalize things a little bit.

Test Plan:
  - Made a comment on the left of diff 1.
  - Made diff 2.
  - Viewed diff 2 vs diff 1.
  - Verified old-left comment was filtered out by the new loop.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T7447

Differential Revision: https://secure.phabricator.com/D12488
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
5645a07d99 Modernize DifferentialInlineCommentQuery
Summary:
Ref T7447. This class is currently a big mess with a lot of `withWeirdSpecialThingUsedInOnePlace()` type qualifiers.

Try to generalize/normalize it a bit.

Test Plan:
- Viewed inline comments.
- Created a new inline comment.
- Edited an inline comment.
- Marked an inline comment complete.
- Deleted, then undeleted an inline comment.
- Previewed inline comments.
- Viewed drafts as another user, verified they don't show up.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: yelirekim, epriestley

Maniphest Tasks: T7447

Differential Revision: https://secure.phabricator.com/D12483
2015-04-21 11:06:44 -07:00
Bob Trahan
2fab72d43b Quicksand - update title while navigating about
Summary: Fixes T7744. Also fixes a bug where we were copying the response object erroneously; that's not necessary to move around since we cleanly initialize it for each load

Test Plan: from user profile, clicked feed tab and saw new title. clicked calendar tab and saw new title. clicked back and saw feed title and page render.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T7744

Differential Revision: https://secure.phabricator.com/D12487
2015-04-21 11:01:05 -07:00
epriestley
80b23b21f3 Work around mailparse bug (?) with messages that have no terminal newline
Summary: Under some unusual circumstances, mailparse appears to incorrectly discard the last line of some mail messages.

Test Plan:
  - Constructed a raw mail with no terminal newline.
  - Piped it into `mail_receiver.php`.
  - Saw the last line vanish into the aether.
  - Applied patch; repeated; last line survived.

Reviewers: btrahan, chad

Reviewed By: chad

Subscribers: chad, epriestley

Differential Revision: https://secure.phabricator.com/D12494
2015-04-21 09:49:40 -07:00
Bob Trahan
d8ab5f594c Quicksand - make page object notifications work properly with quicksand
Summary: Fixes T7680. Make it so the listen behavior can be initialized multiple times from the server by having the behavior only update a few static data variables on subsequent initializations.

Test Plan:
visited TX with user A and left a comment with user B and got the "reload" and "TX updated" bubbles.
Reloaded and navigated to /maniphest/ with user A and had user B leave another comment on TX - no "reload" bubble and correct "TX updated" bubble.
Navigated to TX again with user A and had user B leave a comment and got the "reload" and "TX updated" bubbles.
visited TX with user A and left a comment with user B and got the "reload" and "TX updated" bubbles. navigated away with user A and the "reload" bubble was automagically closed.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T7680

Differential Revision: https://secure.phabricator.com/D12448
2015-04-20 16:43:32 -07:00
epriestley
1602858b26 Possible fix for JX.History spookiness?
Summary: Ref T7573. I only got this reproducing like 10% of the time in Firefox but I can't reproduce it anymore after this change.

Test Plan:
  - Added some logging.
  - Saw Firefox handing us nonsense state values (?)
  - Read the Firefox documentation?
  - Maybe state is expected to be an object? This shouldn't matter?
  - I don't really know?

iiam

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T7573

Differential Revision: https://secure.phabricator.com/D12485
2015-04-20 16:41:19 -07:00
Bob Trahan
4d5badeec0 Quicksand - provide some plumbing for fancier updates
Summary: Ref D12448. Ref T7573. This changes quicksand up a bit so rather than caching just rendered HTML we also cache the initial response from the server. We also fire off a quicksand-redraw event which will let things like the page objects for notifications update correctly while using Quicksand (see D12448).

Test Plan: loaded up /p/btrahan/  Clicked the UI elements to navigate to various profile views up to maniphest. clicked back until back at /p/btrahan/ and it worked. clicked forward until all the way back to maniphest and it worked. clicked back 2x, then clicked new links, then back and it worked

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T7573

Differential Revision: https://secure.phabricator.com/D12449
2015-04-20 15:44:14 -07:00
epriestley
bae0a85dbc Add contextual typeahead function documentation
Summary: Ref T4100. This integration into the "Browse" dialog is probably a little more heavy-handed than we should shoot for.

Test Plan:
{F377131}

{F377132}

Reviewers: btrahan, chad

Reviewed By: chad

Subscribers: epriestley

Maniphest Tasks: T4100

Differential Revision: https://secure.phabricator.com/D12482
2015-04-20 13:43:07 -07:00
Matt Robenolt
6193548b46 Move setup warning callout above the nav-drag div
Summary: See {T7830}

Test Plan: I manually set this to `5` in Chrome inspector and checked a few pages.

Reviewers: chad, #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D12481
2015-04-20 10:53:02 -07:00
Chad Little
0dbd61c2f2 Tweak browse-more CSS
Summary: Just adds some space, color.

Test Plan: test a long browse list

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D12471
2015-04-20 10:19:39 -07:00
epriestley
6fa9b10914 Collapse "Show unassigned tasks" in Maniphest into a parameterized owners typeahead
Summary: Ref T4100. Support viewer(), members(), and add a new none().

Test Plan:
  - Used all new functions.
  - Batch edited tasks with unassign action.
  - Saved a query from master, upgrade it to this patch, checkbox migrated cleanly into a "no one" token.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T4100

Differential Revision: https://secure.phabricator.com/D12470
2015-04-20 10:07:30 -07:00
epriestley
e5e5974d9f Give typeahead browse dialogs sensible titles
Summary: Ref T4100. Let datasources specify a more meaningful title than the class name.

Test Plan: Browsed some sources.

Reviewers: btrahan, chad

Reviewed By: chad

Subscribers: chad, epriestley

Maniphest Tasks: T4100

Differential Revision: https://secure.phabricator.com/D12469
2015-04-20 10:06:23 -07:00
epriestley
b85f8b91de Implement readProjectsFromRequest() helper for SearchEngines
Summary:
Ref T4100. This just makes the "specify stuff in query parameters" workflow a little better:

  - You can now do `?projects=differential,diffusion`.
  - You can now do `?projects=projects(alincoln)`.

Test Plan: Did that stuff ^^^^

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T4100

Differential Revision: https://secure.phabricator.com/D12468
2015-04-20 10:06:22 -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
f331463d50 Make "user's projects" a logical datasource and add viewerprojects()
Summary:
Ref T4100. Ref T5595. This converts `projects(user)` into a logical datasource.

Also adds a viewerprojects() logical datasource.

Test Plan: {F375546}

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T4100, T5595

Differential Revision: https://secure.phabricator.com/D12462
2015-04-20 10:06:20 -07:00
epriestley
c2fc065bfb Implement a project logic datasource
Summary:
Ref T4100. Ref T5595. This allows you to execute all "Projects", "Any Project", "Not in projects" and "include no projects" operations in one field.

It doesn't actually implement such a field yet.

Test Plan: {F375516}

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T5595, T4100

Differential Revision: https://secure.phabricator.com/D12460
2015-04-20 10:06:18 -07:00
epriestley
eb69b115a7 Simplify members() datasource function
Summary: Ref T4100. Implement members() in terms of the real projects datasource.

Test Plan: Used members() functions in Differential, browsed members() functions.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T4100

Differential Revision: https://secure.phabricator.com/D12459
2015-04-20 10:06:17 -07:00
epriestley
c246aa2638 Implement a projects() datasource function
Summary:
Ref T4100. This is like members(), but is implemented on top of the raw datasource. This is a lot simpler and involves way less code duplication.

I'll go back and implement members() like this, too.

Nothing actually uses this yet.

Test Plan:
  - Used browse view to browse datasource.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T4100

Differential Revision: https://secure.phabricator.com/D12458
2015-04-20 10:06:16 -07:00
epriestley
2bbe3b0cbf Move token rendering into Datasources
Summary:
Ref T4100. I want to reduce the amount of code duplication that function datasources currently need to wrap some parameter datasource.

For example, `ProjectMembersDatasource` should really just be a little bit of logic on top of `ProjectsDatasource`, which should do most of the heavy lifting.

Moving rendering into datasources brings us a step closer to being able to do this.

Test Plan:
  - Rendered normal, function, and invalid tokens.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T4100

Differential Revision: https://secure.phabricator.com/D12457
2015-04-20 10:06:14 -07:00
epriestley
a11dab59b0 Require TokenizerControl to always have a datasource
Summary:
Ref T4100. I can simplify the logic a bit here by moving some rendering into the datasources, but a few TokenizerControls currently don't have datasources.

Require datasources and always provide datasources.

Test Plan:
  - Used previously-datasourceless controls (e.g., "Add Reviewers").
  - Used normal controls.
  - Manually verified that no other controls are missing datasources.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T4100

Differential Revision: https://secure.phabricator.com/D12456
2015-04-20 10:06:13 -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
01c99335fd Give Phortune carts a proper isInvoice flag
Summary:
See some earlier discussion in D11593:

> One thing I'm vaguely thinking about is the possibilty that users may be able to invoice one another directly, eventually. For example, we might invoice a contracting client.
> We might need an `isInvoice` flag eventually, but `subscriptionPHID` is a reasonable stand-in for now.

This adds such a flag.

Test Plan:
  - Generated an ad-hoc invoice and verified it showed up in the right place.
  - Used `bin/phortune invoice` to invoice a subscription and verified it worked correctly.
  - Paid an invoice and saw it leave "pending invoices" status.

{F377029}

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D12480
2015-04-20 10:05:44 -07:00
epriestley
0195e751c6 Support basic ad-hoc invoices in Phortune
Summary:
This allows a merchant to send a user an invoice for something arbitrary, like services rendered.

Two major missing parts:

  - These don't actually get marked as invoices. I'll fix that in the next diff, but it's not entirely trivial because `subscriptionPHID` is currently overloaded to also mean "is invoice".
  - We don't send email automatically. I don't plan to fix that for now, since all our invoicing needs are covered by personal email.

Test Plan:
Merchants have a new "new invoice" option:

{F376999}

This leads to selecting a user and account, and then you can generate the invoice (only one actual "purchase" / line item for the moment). You can add a longer-form remarkup description to contextualize the billable items:

{F377001}

This sends the invoice and takes you to the merchant order overview screen:

{F377002}

For now, you copy/paste that link into a nice personal enterprisey business-to-business email; the recipient sees this:

{F377003}

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D12478
2015-04-20 10:05:22 -07:00