Page MenuHomePhorge

Slowvote Application: allow to change the Creation Policy (Default Edit Policy)
Open, WishlistPublic

Description

At the moment a problem in Slowvote is: if you make the Slowvote application public, every registered user can create a Slowvote. That is indeed too powerful ("Fast") and against the "Slow" spirit of Slowvote.

The proposed solution is: allow to set a "Default Edit Policy" in Slowvote. That would allow to setup this desired anti-spam situation in Wikimedia Phabricator:

  • Default Visible To: Public
  • Default Edit Policy: Trusted Users

This was requested from our kind Wikimedia Phabricator folks. Downstream task:

https://phabricator.wikimedia.org/T337031

Inspirationals

Probably we can have great inspiration from this similar patch regarding the Countdown application:

D25101: Countdown: add a capability to decide who can Create

For the records, here is the source code of the Slowvote component:

https://we.phorge.it/source/phorge/browse/master/src/applications/slowvote/

Concrete Stuff

So we should probably:

  1. Create a PhabricatorSlowvoteCreateCapability class inside this directory:

https://we.phorge.it/source/phorge/browse/master/src/applications/slowvote/capability/

P.S. We can probably copy that from PhabricatorCountdownCreateCapability:

https://we.phorge.it/source/phorge/browse/master/src/applications/countdown/capability/PhabricatorCountdownCreateCapability.php

  1. Find what is the curresponding "PhabricatorSlowvoteEngine" class since it exists a "PhabricatorCountdownEditEngine"

https://we.phorge.it/source/phorge/browse/master/src/applications/countdown/editor/PhabricatorCountdownEditEngine.php

  1. Edit the PhabricatorSlowvoteApplication::getCustomCapabilities():

https://we.phorge.it/source/phorge/browse/master/src/applications/slowvote/application/PhabricatorSlowvoteApplication.php

To do something like this:

https://we.phorge.it/source/phorge/browse/master/src/applications/countdown/application/PhabricatorCountdownApplication.php;7ed35123a347a05c70c97eba2bec2b36eb2b3218$53-56