Page MenuHomePhabricator

Describe "catchall" endpoint for Jade
Closed, ResolvedPublic

Description

action=jadeproposeorendorse

A Catch all, routing method that tries to *do the right thing*

@param title (str) The encoded entity name.  (E.g. "Jade:Diff/123456") [required if entitytype or entityid are not set]
@param entitydata (json) The type of Jade entity (E.g., {"type": "diff", "id": 3245678}) [required if title not set]
@param facet (str) The facet of the entity being labeled [required]
@param labeldata (json) The relevant new label data [required]
@param notes (str) Notes to save when creating a new proposal (A warning will be raised if a proposal already exists.  Notes will not be automatically overwritten.)
@param endorsementcomment (str) Comment to leave with the endorsement.  Defaults to "As proposer" if not set and creating new proposal. 
@param origin (str) A structured string representing what the user was looking at when they made this judgment [required]
@param comment (str) Revision summary
@param token (str) [required]
@warning endorsingnonpreferredproposal -- This action resulted in creating an endorsement for a proposal that is not flagged as preferred.

Decision tree

  • Does the entity page exist at all?
    • Yes
      • Does the target facet already have a proposal with the target labeldata?
        • Yes
          • Has the user already endorsed a proposal within the target facet?
            • Yes
              • Has the user already endorsed the target proposal?
                • Yes: update endorsementcomment if set & warn existingproposalnotesnotoverwritten (comment: /* jade-updateendorsement */)
                • No: move endorsement to target proposal & warn existingproposalnotesnotoverwritten (comment: /* jade-moveendorsement */)
                  • Is the target proposal preferred?
                    • No: warn endorsingnonpreferredproposal
            • No: create endorsement & warn existingproposalnotesnotoverwritten (comment: /* jade-endorseproposal */)
              • Is the target proposal preferred?
                • No: warn endorsingnonpreferredproposal
        • No
          • Has the user already endorsed a proposal within the target facet?
            • Yes: create proposal and move endorsement with updated endorsementcomment (comment: /* jade-createproposalandmoveendorsement */)
            • No: create proposal and endorsement (comment: /* jade-createandendorseproposal */)
          • Is the target proposal preferred? (Note that if any other proposal existed at this time, then "No")
            • No: warn endorsingnonpreferredproposal
    • No: create proposal and endorsement (comment: /* jade-createandendorseproposal */)

4 major cases

  1. The entity page doesn't exist at all. (comment: /* jade-createandendorseproposal */)
    • Create the page, create the relevant proposal
    • Add an endorsement from the user.
  2. The entity page exists but proposal with matching labeldata and the user has not already endorsed a proposal for this facet (comment: /* jade-createandendorseproposal */)
    • Create the relevant proposal.
    • Add an endorsement from the user.
    • If another proposal exists for the target facet: Raise a endorsingnonpreferredproposal warning and leave the preferred bit alone
  3. The entity page exists and there's a proposal with matching labeldata. (comment: /* jade-endorseproposal */)
    • Add an endorsement from the user.
    • Raise an existingproposalnotesnotoverwritten warning
    • If the proposal is not preferred: Raise a endorsingnonpreferredproposal warning and leave the //preferred bit alone
  4. The user already has an endorsement for this facet but it is for a different proposal. A. If the target labeldata is not represented in any proposal: Create the proposal (comment: /* jade-createproposalandmoveendorsement */)
    • Move the user's endorsement to the target proposal and update the endorsementcomment.
    • If the proposal is not preferred: Raise a endorsingnonpreferredproposal warning and leave the preferred bit alone B. Otherwise, if the target labeldata exists, just move the endorsement. (comment: /* jade-moveendorsement */)
    • Raise an existingproposalnotesnotoverwritten warning
    • If the proposal is not preferred: Raise a endorsingnonpreferredproposal warning and leave the preferred bit alone

Event Timeline

Halfak claimed this task.Jul 30 2019, 5:41 PM
Halfak created this task.
Halfak updated the task description. (Show Details)Jul 31 2019, 10:20 PM
Halfak updated the task description. (Show Details)Aug 1 2019, 9:54 AM
Halfak updated the task description. (Show Details)Aug 1 2019, 10:17 AM
Halfak updated the task description. (Show Details)Aug 1 2019, 10:20 AM
Halfak updated the task description. (Show Details)Aug 1 2019, 10:23 AM
Halfak updated the task description. (Show Details)
Halfak updated the task description. (Show Details)

@ACraze, I think this is mostly complete. Please review and let me know if you have any questions.

Halfak updated the task description. (Show Details)Aug 1 2019, 10:25 AM
Halfak updated the task description. (Show Details)

@Halfak This all seems correct from a high level perspective. I think it's ready to start prototyping.

Halfak closed this task as Resolved.Tue, Sep 17, 2:56 PM