Page MenuHomePhabricator

Differential - add DifferentialDraft to track whether revisions have draft feedback or not
ClosedPublic

Authored by btrahan on Feb 19 2014, 12:03 AM.
Tags
None
Referenced Files
F14035527: D8275.id19692.diff
Sun, Nov 10, 6:19 AM
F14035516: D8275.id19688.diff
Sun, Nov 10, 6:16 AM
F14006926: D8275.id19692.diff
Mon, Oct 28, 9:31 PM
F13998533: D8275.diff
Thu, Oct 24, 9:40 AM
F13994440: D8275.diff
Wed, Oct 23, 6:09 AM
F13964165: D8275.id19688.diff
Tue, Oct 15, 7:53 PM
F13961438: D8275.id19689.diff
Tue, Oct 15, 5:06 AM
F13961236: D8275.id19691.diff
Tue, Oct 15, 3:57 AM

Details

Reviewers
epriestley
Maniphest Tasks
Restricted Maniphest Task
Commits
Restricted Diffusion Commit
rPdcd7a316d239: Differential - add DifferentialDraft to track whether revisions have draft…
Summary

...do it somewhat generically, so we could fairly easily add this to other applications. Fixes T3496. I got a wee bit lazy and decided not to migrate existing drafts. My excuses aside from laziness are doing it this way will let us see if anyone complains, we can always do a migration later if people do complain, and there's likely to be a lot of garbage data for older / bigger installs, and the migration didn't seem worth itgiven it would also likely be expensive in these cases.

Test Plan

made a draft inline comment on DX and observed DX had a note icon on Differential home page. made a draft comment on DX and observed DX had a note icon on Differential home page. deleted a draft inline comment and noted icon disappeared from Differential homepage. Submitted a draft comment + inline comment and noted icon disappeared.

Diff Detail

Repository
rP Phabricator
Branch
T3496
Lint
Lint Passed
Unit
Tests Passed

Event Timeline

I spent too much time on this because I was never too happy with the result.

Storage wise, i think this is the best way to not make things too complicated given "has draft" can come from a main comment box or inline, thus needing draft key and N rows to cleanly manage adding / deleting, though clearly only one row is needed to say "has draft"

Feature wise, I think this is valuable and likely to be valuable generally in other applications. I could imagine Conpherence (for example) showing off something "has a draft" in the UI. All that said, the existing DIfferential users probably keep around tons of diffs which is not exactly how I think the tool is best used.

src/applications/differential/controller/DifferentialCommentPreviewController.php
129

this is maybe not a good idea - once replaceOrDelete() is called once isDeleted() is always true and other oddities - but I don't think we delete() then save() stuff...? maybe delete() needs to be handled in PhabricatorDraft though too?

src/applications/differential/storage/DifferentialDraft.php
3

feel free to pick on the class name here and the method names

btrahan updated this revision to Unknown Object (????).Feb 19 2014, 12:10 AM

kill a stray phlog

this is so beautiful

it brings tears to my eyes ;_;

Totally agreed about not migrating. We might be able to do a fake INSERT IGNORE ... CLEVER SELECT BLAH "migration" that kind of approximates the right end state if anyone complains but I don't think this feature sees a ton of use.

src/applications/differential/storage/DifferentialDraft.php
47

stray phlog

src/applications/differential/controller/DifferentialCommentPreviewController.php
129

Checking for strlen($request->getStr('content')) is a little more redundant but might be less perilous.

btrahan updated this revision to Unknown Object (????).Feb 19 2014, 12:25 AM
  • implement didDelete() hook to make this a little tighter
  • also, if it was deleted, then delete the pertinent DifferentialDraft row (fixes a bug where just deleting your main comment didn't clear the notion of has draft)