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)
Thu, Mar 14, 11:14 PM
Unknown Object (File)
Tue, Mar 5, 12:20 AM
Unknown Object (File)
Jan 30 2024, 6:54 PM
Unknown Object (File)
Jan 23 2024, 11:56 AM
Unknown Object (File)
Jan 21 2024, 2:24 PM
Unknown Object (File)
Jan 21 2024, 2:24 PM
Unknown Object (File)
Jan 9 2024, 10:19 AM
Unknown Object (File)
Dec 30 2023, 12:02 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.