1. 14 May, 2020 4 commits
  2. 13 May, 2020 1 commit
    • epriestley's avatar
      Improve line breaking behavior in Firefox and Chrome under complex conditions · 1da54837
      epriestley authored
      Summary: See <https://github.com/phacility/phabricator/pull/854>. In some situations, `line-break: anywhere` produces better behavior than `word-break: break-all`. It never appears to produce worse behavior.
      Test Plan:
        - Break behavior changes if a line contains "<span />" elements caused by syntax highlighting. This CSS adjustment only appears to apply to text with internal "<span />" elements.
        - This specifically impacts certain internal breakpoints adjacent to punctuation, so the test case is highly specific. Generic test cases with latin word characters do not evidence any behavioral changes.
        - This change appears to have no impact on Safari, which uses the better behavior in all cases.
        - Before Patch: In Firefox and Chrome, this specific change breaks awkwardly. There is more room for text to fit on the broken line:
        - After Patch: Firefox and Chrome break the line better. Here's Firefox:
        - Additional context:
      Safari Behavior (Unchanged)
      Chrome with no highlighting (desirable behavior). Firefox does the same thing.
      Also tested other cases, which seem never-worse in any browser.
      Differential Revision: https://secure.phabricator.com/D21247
  3. 12 May, 2020 2 commits
    • epriestley's avatar
      Make "View as Document Type..." only show valid options · acc1fa16
      epriestley authored
      Ref T13513. Currently, "View as Document Type..." lists every available engine.
      This is hard to get completely right because we can't always rebuild the document ref accurately in the endpoint, but try harder to fake something reasonable.
      Test Plan: Used "View as Document Type..." on Jupyter notebooks, was given "Jupyter" and "Source" as options.
      Maniphest Tasks: T13513
      Differential Revision: https://secure.phabricator.com/D21241
    • epriestley's avatar
      When creating an inline, save the current document engine · 0cca40db
      epriestley authored
      Ref T13513. As part of inline metadata, save the document engine the change is being rendered with.
      This will allow other parts of the UI to detect that an inline was created on a Jupyter notebook but is being rendered on raw source, or whatever else.
      The immediate goal is to fix nonsensical inline snippet rendering in email on Jupyter notebooks.
      Test Plan:
        - Created inlines and replies on normal soure code, saw no document engine annotated in the database.
        - Created inlines and replies on a Jupyter notebook rendered in Jupyter mode, saw "jupyter" annotations in the database.
        - Swapped document engines between Jupyter and Source, etc.
      Maniphest Tasks: T13513
      Differential Revision: https://secure.phabricator.com/D21240
  4. 08 May, 2020 3 commits
    • epriestley's avatar
      Make "Delete" from inline comment previews function correctly while editing comments · e7ebd5d9
      epriestley authored
      Summary: Ref T13513. Currently, if you're editing a comment, "delete" doesn't put the comment into the correct state. This action is normally only reachable from comment previews, since an editing inline has no "delete" button.
      Test Plan:
        - Started editing an inline, clicked "Delete", got a deletion.
        - Created an inline, typed text,
        - Deleted a normal comment via preview.
        - Deleted a normal comment via the on-inline action.
      Maniphest Tasks: T13513
      Differential Revision: https://secure.phabricator.com/D21238
    • epriestley's avatar
      Make "View" from inline comment previews correctly jump to "isEditing" inlines · b804e8cf
      epriestley authored
      Ref T13513. Currently, clicking "View" from the inline comment preview (below the "add comment" area at the bottom of the page) only works if the inline isn't being edited.
      Update this behavior so it works on inlines in either "Viewing" or "Editing" states.
      Test Plan:
        - Clicked "View" on a normal inline, got jumped/selected.
        - Clicked "View" on an editing inline, got jumped/selected.
      Maniphest Tasks: T13513
      Differential Revision: https://secure.phabricator.com/D21237
    • epriestley's avatar
      Persist "Show Changeset" and improve path text selection · 24ba66f1
      epriestley authored
      Ref T13513. Currently:
        - If you click the "Show Changeset" button, your state change doesn't actually get saved on the server.
        - It's hard to select a changeset path name for copy/paste because the "highlight the header" code tends to eat the event.
      Instead: persist the former event; make the actual path text not be part of the highlight hitbox.
      Test Plan:
        - Clicked "Show Changeset", reloaded, saw changeset visibility persisted.
        - Selected changeset path text without issues.
        - Clicked non-text header area to select/deselect changesets.
      Maniphest Tasks: T13513
      Differential Revision: https://secure.phabricator.com/D21236
  5. 07 May, 2020 1 commit
  6. 04 May, 2020 9 commits
    • epriestley's avatar
      Fix a JS issue when the anchor element on a page has no container · 6b691029
      epriestley authored
      Summary: See D21213. If there's no matching element, `findAbove()` throws. Handle these cases correctly.
      Test Plan: Visited `#toc` on a revision, no longer saw a JS error.
      Differential Revision: https://secure.phabricator.com/D21222
    • epriestley's avatar
      When cancelling an unsaved editing inline after a reload, don't cancel into an empty state · 07e160bd
      epriestley authored
      Ref T13513. Overloading "original text" to get "edit-on-load" comments into the right state has some undesirable side effects.
      Instead, provide the text when the editor opens. This fixes a cancel interaction.
      Test Plan:
        - Create an inline, type text, don't save.
        - Reload page.
        - Cancel.
        - Before: cancelled into empty state.
        - After: cancelled into deleted+undo state.
      Maniphest Tasks: T13513
      Differential Revision: https://secure.phabricator.com/D21219
    • epriestley's avatar
      When loading a page with inlines, don't select/focus inlines which we... · 3a762480
      epriestley authored
      When loading a page with inlines, don't select/focus inlines which we immediately upgrade to "editing"
      Ref T13513. This is a bit clumsy, but the cleanest way to implement "isEditing" inlines today is to send them down as normal inlines and then simulate clicking "edit" on them.
      When we do, don't focus the resulting editor: focusing it makes the page scroll around and highlight things in essentially random order as the editors load in.
      Test Plan: Reloaded a page with some open editors, wasn't scrolled to them.
      Maniphest Tasks: T13513
      Differential Revision: https://secure.phabricator.com/D21217
    • epriestley's avatar
      Save drafts for inline comments currently being edited · fe501bd7
      epriestley authored
      Ref T13513. As users type text into inline comments, save the comment state as a draft on the server.
      This has some rough edges, particularly around previews, but mostly works. See T13513 for notes.
      Test Plan: Started an inline, typed some text, waited a second, reloaded the page, saw an editing inline with the saved text.
      Maniphest Tasks: T13513
      Differential Revision: https://secure.phabricator.com/D21216
    • epriestley's avatar
      Refine unusual inline comment client interactions · 63bfad0f
      epriestley authored
      Summary: Ref T13513. Refine some inline behaviors, see test plan.
      Test Plan:
        - Edit a comment ("A"), type text ("AB"), cancel, edit.
          - Old behavior: edit and undo states (wrong, and undo does not function).
          - New behavior: edit state only.
        - Edit a comment ("A"), type text ("AB"), cancel. Undo ("AB"), cancel. Edit.
          - Old behavior: "AB" (wrong: you never submitted this text).
          - New behavior: "A".
        - Create a comment, type text, cancel.
          - Old behavior: counter appears in filetree (wrong, comment is undo-able but should not be counted).
          - New behavior: no counter.
        - Cancel editing an empty comment with no text.
          - Old behavior: Something buggy -- undo, I think?
          - New behavior: it just vanishes (correct behavior).
      Maniphest Tasks: T13513
      Differential Revision: https://secure.phabricator.com/D21212
    • epriestley's avatar
      When users submit "editing" inlines, warn them that their inlines will be saved · 67da18e3
      epriestley authored
      Summary: Ref T13513. This slightly expands the existing-but-hacky "warning" workflow to cover both "mentions on draft" and "submitting inlines being edited".
      Test Plan:
        - Submitted changes to a revision with mentions on a draft, inlines being edited, both, and neither.
        - Got sensible warnings in the cases where warnings were appropriate.
      Maniphest Tasks: T13513
      Differential Revision: https://secure.phabricator.com/D21191
    • epriestley's avatar
      When a user clicks "Cancel" on an inline comment to leave the "Editing" state,... · b2ce0844
      epriestley authored
      When a user clicks "Cancel" on an inline comment to leave the "Editing" state, save the state change
      Ref T13513. Now that the "currently being edited" state of inlines is saved on the server side, clear the flag when the user clicks "Cancel" to leave the "editing" state on the client.
      This also serves to delete empty comments.
      Test Plan:
        - Clicked a line number to create a new comment. Then:
          - Clicked "Cancel". Reloaded page, saw no more comment.
          - Typed text, saved. Reloaded page, saw non-editing draft. Clicked "Edit", reloaded page, saw editing draft. Clicked "Cancel", reloaded page, saw non-editing draft.
          - Typed text, saved. Clicked "Edit", deleted text, saved. Reloaded page, saw no more comment.
      Maniphest Tasks: T13513
      Differential Revision: https://secure.phabricator.com/D21187
    • epriestley's avatar
      Make "editing" state persistent for inline comments · b48a22bf
      epriestley authored
      Ref T13513. This is mostly an infrastructure cleanup change.
      In a perfect world, this would be a series of several changes, but they're tightly interconnected and don't have an obvious clean, nontrivial partition (or, at least, I don't see one). Followup changes will exercise this code repeatedly and all of these individual mutations are "obviously good", so I'm not too worried about the breadth of this change.
      Inline comments are stored as transaction comments in the `PhabricatorAuditTransactionComment` and `DifferentialTransactionComment` classes.
      On top of these two storage classes sit `PhabricatorAuditInlineComment` and `DifferentialInlineComment`. Historically, these were an indirection layer over significantly different storage classes, but nowadays both storage classes look pretty similar and most of the logic is actually the same. Prior to this change, these two classes were about 80% copy/pastes of one another.
      Part of the reason they're so copy/pastey is that they implement a parent `Interface`. They are the only classes which implement this interface, and the interface does not provide any correctness guarantees (the storage objects are not actually constrained by it).
      To simplify this:
        - Make `PhabricatorInlineCommentInterface` an abstract base class instead.
        - Lift as much code out of the `Audit` and `Differential` subclasses as possible.
        - Delete methods which no longer have callers, or have only trivial callers.
      Inline comments have two `View` rendering classes, `DetailView` and `EditView`. They share very little code.
      Partly, this is because `EditView` does not take an `$inline` object. Historically, it needed to be able to operate on inlines that did not have an ID yet, and even further back in history this was probably just an outgrowth of a simple `<form />`.
      These classes can be significantly simplified by passing an `$inline` to the `EditView`, instead of individually setting all the properties on the `View` itself. This allows the `DetailView` and `EditView` classes to share a lot of code.
      The `EditView` can not fully render its content. Move the content rendering code into the view.
      Prior to this change, some operations need to work on inlines that don't have an inline ID yet (we assign an ID the first time you "Save" a comment). Since "editing" comments will now be saved, we can instead create a row immediately.
      This means that all the inline code can always rely on having a valid ID to work with, even if that ID corresponds to an empty, draft, "isEditing" comment. This simplifies more code in `EditView` and allows the "create" and "reply" code to be merged in `PhabricatorInlineCommentController`.
      Client-side inline events are currently handled through a mixture of `ChangesetList` listeners (good) and ad-hoc row-level listeners (less good). In particular, the "save", "cancel", and "undo" events are row-level. All other events are list-level.
      Move all events to list-level. This is supported by all inlines now having an ID at all stages of their lifecycle.
      This allows some of the client behavior to be simplified. It currently depends on binding complex ad-hoc dictionaries into event handlers in `_drawRows()`, but it seems like almost all of this code can be removed. In fact, no more than one row ever seems to be drawn, so this code can probably be simplified further.
      Finally, save an "isEditing" state. When we rebuild a revision on the client, click the "edit" button if it's in this state. This is a little hacky, but simpler to get into a stable state, since the row layout of an inline depends on a "view row" followed by an "edit row".
      Test Plan:
        - Created comments on either side of a diff.
        - Edited a comment, reloaded, saw edit stick.
        - Saved comments, reloaded, saw save stick.
        - Edited a comment, typed text, cancelled, "unedited" to get state back.
        - Created a comment, typed text, cancelled, "unedited" to get state back.
        - Deleted a comment, "undeleted" to get state back.
      Weirdness / known issues:
        - Drafts don't autosave yet.
        - Fixed in D21187:
          - When you create an empty comment then reload, you get an empty editor. This is a bit silly.
          - "Cancel" does not save state, but should, once drafts autosave.
        - Mostly fixed in D21188:
          - "Editing" comments aren't handled specially by the overall submission flow.
          - "Editing" comments submitted in that state try to edit themselves again on load, which doesn't work.
      Subscribers: jmeador
      Maniphest Tasks: T13513
      Differential Revision: https://secure.phabricator.com/D21186
    • epriestley's avatar
      Restore highlighting when jumping to transactions using URI anchors · 54ec5662
      epriestley authored
      At some point, the highlighting behavior for the timeline broke. When you follow a link to a particular timeline story, the story should be highlighted.
      Prior to this change, the `<a />` tag itself highlights, but there's no associated CSS and it's too deep in the tree to do anything useful.
      (Since this change is fairly straightforward, I gave up digging for the root cause before finding it.)
      Test Plan:
        - Clicked a timeline story anchor, saw the story highlight.
      Differential Revision: https://secure.phabricator.com/D21213
  7. 01 May, 2020 1 commit
  8. 28 Apr, 2020 1 commit
    • epriestley's avatar
      Update the diff table of contents to use hierarchical views and edit distance renames · f21f1d8a
      epriestley authored
      Ref T13520. Generally, make the table of contents look and more like the paths panel:
        - Show a hierarchy, with compression for single-sibling children.
        - Use the same icons, instead of "M D" and "(img)" stuff.
        - Use EditDistanceMatrix to do a piece-by-piece diff of paths changes.
        - Show path changes within the path list.
      I'm not entirely sold on this, but it was complicated to write and I've never heard the term "sunk cost fallacy". I think this is mostly a net improvement, but may need some adjustments and followup.
      Test Plan: Viewed various changes in Differential and Diffusion, saw a more usable table of contents.
      Maniphest Tasks: T13520
      Differential Revision: https://secure.phabricator.com/D21183
  9. 24 Apr, 2020 1 commit
  10. 23 Apr, 2020 4 commits
    • epriestley's avatar
      Update static resource package definitions · e20feeee
      epriestley authored
      Summary: Ref T13516. Differential got some new UI elements and behaviors, so update static resource package definitions.
      Test Plan:
        - Saw JS requests drop from 17 to 4.
        - Saw CSS requests drop from 9 to 3.
      (These won't quite match production since some JS/CSS is for DarkConsole.)
      Maniphest Tasks: T13516
      Differential Revision: https://secure.phabricator.com/D21163
    • epriestley's avatar
      Don't show the "file tree" view on tablets/phones · 4793bfcb
      epriestley authored
      Summary: Ref T13516. Hide this UI on devices without the screen width to reasonably support it.
      Test Plan: Viewed a revision at various window widths, saw the elements vanish at device widths and reappear at desktop widths.
      Maniphest Tasks: T13516
      Differential Revision: https://secure.phabricator.com/D21162
    • epriestley's avatar
      Refine more Differential review state behaviors · d2572f8b
      epriestley authored
      Ref T13516.
      - Add an "Add Comment" navigation anchor.
      - Make selection state more clear.
      - Make hidden state tidier and more clear.
      - Hide "View Options" in the hidden state to dodge all the weird behaviors it implies.
      - Click to select/deselect changesets.
      - When you open the view dropdown menu, then press "h", close the dropdown menu.
      Test Plan: Fiddled with all these behaviors.
      Maniphest Tasks: T13516
      Differential Revision: https://secure.phabricator.com/D21161
    • epriestley's avatar
      Update the "View Options" menu for recent filetree changes · 0ede616f
      epriestley authored
      Ref T13516. Minor improvements here:
        - Show key commands in the "View Options" dropdown.
        - Organize it slightly better.
        - Improve disabled item behaviors a little bit.
        - Add a "Browse Directory" action.
        - Rename "...in Diffusion" to "...in Repository".
        - Make "d", "D", and "h" use the same targeting rules as "\".
        - When you hide a file with the "h" menu item, select it.
      Test Plan: Poked at the menu a lot, ran into less questionable behavior.
      Maniphest Tasks: T13516
      Differential Revision: https://secure.phabricator.com/D21160
  11. 22 Apr, 2020 9 commits
  12. 19 Apr, 2020 4 commits
    • epriestley's avatar
      Restore editor behavior to Diffusion and support "\" shortcut · ef69c796
      epriestley authored
      Ref T13515. This restores the "Open in Editor" behavior to Diffusion, and makes "\" work there.
      The URI pattern is now sent as a structured template to the client, so the code will work properly if a file path contains "%l".
      Test Plan:
        - Clicked "Open in Editor" and pressed "\" in Diffusion when viewing a file.
        - Clicked a line, hit "\", got the file opened to that line.
      Maniphest Tasks: T13515
      Differential Revision: https://secure.phabricator.com/D21149
    • epriestley's avatar
      In Differential, make the "Open in Editor" keystroke work with no selection,... · 537ff68e
      epriestley authored
      In Differential, make the "Open in Editor" keystroke work with no selection, or a change or inline selected
      Ref T13515. Currently, "Open in Editor" only works with a file-level selection.
        - If we have a change-level or inline-level selection, open the parent changeset.
        - If we have no selection, but the banner is showing something, open the fine shown in the banner.
      Test Plan: With files, inlines, changes, and no selection, pressed "\". Saw files pop open in my external editor.
      Maniphest Tasks: T13515
      Differential Revision: https://secure.phabricator.com/D21148
    • epriestley's avatar
      Make the "Keyboard Shortcuts" dialog in Differential less hideous · 8bdc7133
      epriestley authored
      Ref T13515. Adding "\" ("Open in External Editor") made this slighlty worse, but it was already pretty bad.
      Long ago the keys had a special style on them, but this got changed and dropped somewhere around D16568 -- although at the time, I think they still had a grey background (see T11654).
      Some later change removed this background.
      Put the background back and separate the keystrokes into groups.
      Test Plan: {F7370615}
      Maniphest Tasks: T13515
      Differential Revision: https://secure.phabricator.com/D21141
    • epriestley's avatar
      Make "renderer", "engine", and "encoding" sticky across reloads in Differential and Diffusion · c3c55d82
      epriestley authored
      Ref T13455. Update the other "view state" properties to work like "highlight" now works.
      Some complexity here arises from these concerns:
        - In "View Standalone", we render the changeset inline. This is useful for debugging/development, and desirable to retain.
        - In all other cases, we render the changeset with AJAX.
      So the client needs to be able to learn about the "state" properties of the changeset on two different flows. Prior to this change, each pathway had a fair amount of unique code.
      Then, some bookkeeping issues:
        - At inital rendering time, we may not know which renderer will be selected: it may be based on the client viewport dimensions.
        - Prior to this change, the client didn't separate "value of the property for the changeset as rendered" and "desired value of the property".
      Test Plan:
        - Viewed changes in Differential, Diffusion, and in standalone mode.
        - Toggled renderer, character sets, and document engine (this one isn't terribly useful). Reloaded, saw them stick.
        - Started typing a comment, cancelled it, hit the undo UI.
      Maniphest Tasks: T13455
      Differential Revision: https://secure.phabricator.com/D21138