Page MenuHomePhabricator

Reimplement Slowvote transactions using modular transactions
ClosedPublic

Authored by amckinley on May 4 2017, 11:45 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Dec 18, 1:07 AM
Unknown Object (File)
Tue, Dec 17, 7:03 AM
Unknown Object (File)
Tue, Dec 17, 3:46 AM
Unknown Object (File)
Sat, Dec 14, 8:05 PM
Unknown Object (File)
Sat, Dec 14, 2:02 AM
Unknown Object (File)
Thu, Dec 12, 6:27 AM
Unknown Object (File)
Fri, Nov 29, 5:41 PM
Unknown Object (File)
Sun, Nov 24, 11:36 AM
Subscribers

Details

Summary

Fixes T12623. Adds new modular transactions to Slowvote. Also converts
the shuffle column to bool for consistency with other boolean-ish columns.

Test Plan

Create a new vote, modified everything that could be modified from the web UI,
observed expected timeline.

Example timeline:

Screen Shot 2017-05-04 at 4.40.36 PM.png (1×1 px, 149 KB)

Example transaction values in DB:

Screen Shot 2017-05-04 at 4.50.23 PM.png (335×754 px, 50 KB)

Diff Detail

Repository
rP Phabricator
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

amckinley edited the test plan for this revision. (Show Details)

Some minor things inline, yell if I made any of it up or it doesn't make sense or whatever?

src/applications/slowvote/xactions/PhabricatorSlowvoteCloseTransaction.php
9–19

Per discussion elsewhere, you could use the "two int casts" here instead of "bool + bool + int", but they're basically equivalent.

And "bool + bool + int" is actually better if/when we write a Conduit transaction.search sort of method (read all transactions for an object) since it's cleaner to expose true and false than 1 and 0.

But we might need an indirection layer anyway ("get the API version of this transaction") and that could do all the casts, so who knows.

I think this is basically fine until the day when we eventually have some clarity around MySQL types vs Lisk types vs stored types vs API types. None of this stuff is too terribly difficult to fix retroactively later even if we end up making unexpected decisions.

62–64

You can just omit this method since it doesn't do anything, I think.

src/applications/slowvote/xactions/PhabricatorSlowvoteDescriptionTransaction.php
61–64

(Can omit.)

src/applications/slowvote/xactions/PhabricatorSlowvoteResponsesTransaction.php
10–12

I think you should be able to omit this case and just return the (int) cast if you also set the response visibility to a valid value by default, which is generally desirable anyway. You can do this in initializeNewPoll() if the best default is complex, or just in protected $responseVisibility = ...; for simple values.

17

(Stray debugging code.)

37–39

Omit.

src/applications/slowvote/xactions/PhabricatorSlowvoteShuffleTransaction.php
10–12

Same as above -- with a sensible default on SlowvotePoll, you should be able to get rid fo this.

This revision is now accepted and ready to land.May 5 2017, 1:46 AM
  • removing bogus null check
This revision was automatically updated to reflect the committed changes.