Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposals: Display correct abandoned proposal vote status. #1909

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions cmd/dcrdata/views/proposals.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -141,16 +141,20 @@
</td>
<td class="text-start">
{{if .VoteStatus}}
{{if eq (index $.VotesStatus .VoteStatus) "Unauthorized"}}
{{if eq (index $.VotesStatus .VoteStatus) "Ineligible"}}
{{if .AbandonedAt}}
Comment on lines +144 to 145
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What would it mean to be Ineligible but not AbandonedAt?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hrmm all ineligible proposals should have abandonedat timestamp.
We can detch the internal if.

Copy link
Member Author

@amass01 amass01 Mar 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually censored proposals are also Ineligible, so we better keep that if.

// VoteStatusIneligible indicates that a record is not eligible to
// be voted on. This happens when a record is censored or archived.
VoteStatusIneligible VoteStatusT = 7

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hrmm we need to add a check for censored proposals as well.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So should we display "Censored" in that case?
Can you make a summary of the different Pi prop statuses and how we get to them?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added an else if for the censored case.
Will test that against local politeia.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might consider using the new politeia metadata for that. see decred/politeia#1515.

Command code:
https://github.com/decred/politeia/blob/master/politeiawww/api/pi/v1/v1.go#L330-L351

Proposal status possible values:
https://github.com/decred/politeia/blob/master/politeiad/plugins/pi/pi.go#L426-L522

// PropStatusT represents the status of a proposal. It combines record and
// plugin metadata in order to create a unified map of the various paths a
// proposal can take throughout the proposal process. This serves as the
// source of truth for clients so that they don't need to try and decipher
// what various combinations of plugin metadata mean for the proposal.
//
// The proposal status is determined at runtime by the pi plugin based on the
// various record and plugin metadata that a proposal contains.
type PropStatusT string

const (
	// PropStatusInvalid represents an invalid proposal status.
	PropStatusInvalid PropStatusT = "invalid"

	// PropStatusUnvetted represents a proposal that has been submitted but has
	// not yet been made public by the admins.
	PropStatusUnvetted PropStatusT = "unvetted"

	// PropStatusUnvettedAbandoned represents a proposal that has been
	// submitted, but was abandoned by the author prior to being made public.
	// The proposal can be marked as abandoned by either the proposal author
	// or an admin. Abandoned proposal files are not deleted from the backend
	// and are still retreivable. An abandoned proposal is locked against any
	// additional proposal or plugin changes.
	PropStatusUnvettedAbandoned PropStatusT = "unvetted-abandoned"

	// PropStatusUnvettedCensored represents a proposal that has been submitted,
	// but was censored by an admin prior to being made public. Censored
	// proposal files are permanently deleted from the backend. No additional
	// changes can be made to the proposal once it has been censored.
	PropStatusUnvettedCensored PropStatusT = "unvetted-censored"

	// PropStatusUnderReview represents a proposal that has been made public and
	// is being reviewed by the Decred stakeholders, but has not had it's voting
	// period started yet.
	PropStatusUnderReview PropStatusT = "under-review"

	// PropStatusAbandoned represents a proposal that has been made public, but
	// has been abandoned. A proposal can be marked as abandoned by either the
	// proposal author or by an admin. Abandoned proposals are locked from any
	// additional changes. Abandoned proposal files are not deleted from the
	// backend.
	PropStatusAbandoned PropStatusT = "abandoned"

	// PropStatusCensored represents a proposal that was censored by an admin
	// after it had already been made public. This can happen if an edit to the
	// proposal adds content that requires censoring.  Censored proposal files
	// are permanently deleted from the backend. No additional changes can be
	// made to the proposal once it has been censored.
	PropStatusCensored PropStatusT = "censored"

	// PropStatusVoteAuthorized represents a public proposal whose voting period
	// has been authorized by the author. An admin cannot start the voting
	// period of a proposal until the author has authorized it.
	PropStatusVoteAuthorized PropStatusT = "vote-authorized"

	// PropStatusVoteStarted represents a public proposal that is currently
	// under vote by the Decred stakeholders. The voting period for a proposal
	// is started by an admin. The proposal content cannot change once the
	// voting period has been started, but some plugin data (e.g. comments) can
	// still be added.
	PropStatusVoteStarted PropStatusT = "vote-started"

	// PropStatusApproved represents a proposal that was voted on by the Decred
	// stakeholders, met the approval criteria, but is not being actively billed
	// against. An example is an RFP proposal. RFP proposals do not request
	// funding and are not billed against once approved.
	PropStatusApproved PropStatusT = "approved"

	// PropStatusRejected represents a proposal that was voted on by the Decred
	// stakeholders and did not meet the approval criteria. A rejected proposal
	// is locked against any additional proposal or plugin changes.
	PropStatusRejected PropStatusT = "rejected"

	// PropStatusActive represents a proposal that was voted on by the Decred
	// stakeholders, met the approval criteria, and is now eligible to be billed
	// against. The proposal automatically becomes active once the voting period
	// ends. The proposal content of an active proposal cannot be altered. Some
	// plugin functionality is still allowed. For example, an author is allowed
	// to start a new comment thread in order to give proposal updates that
	// users can reply to.
	PropStatusActive PropStatusT = "active"

	// PropStatusCompleted represents a proposal that was funded by the Decred
	// stakeholders and has been completed. A completed proposal is marked as
	// completed by an admin and is no longer being billed against. A completed
	// proposal is locked against any additional proposal or plugin changes.
	PropStatusCompleted PropStatusT = "completed"

	// PropStatusClosed represents a proposal that was funded, but was never
	// completed. A proposal is marked as closed by an admin and cannot be
	// billed against any further. The most common reason a proposal would be
	// closed is because the author failed to deliver on the milestones laid
	// out in the  proposal. A closed proposal is locked against any additional
	// proposal or plugin changes.
	PropStatusClosed PropStatusT = "closed"
)

Copy link
Collaborator

@ukane-philemon ukane-philemon Mar 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Censored
// proposal files are permanently deleted from the backend.

can dcrdata access censored proposals during import? since they are deleted from the backend?
Afaict, since censored proposals are deleted, they can't be accessed, hence they become invalid?

<span class="text-abandoned position-relative" data-tooltip="Proposal abandoned">
Abandoned
</span>
{{else}}
<span class="text-abandoned position-relative" data-tooltip="Proposal in discussion">
In Discussion
{{else if .CensoredAt}}
<span class="text-abandoned position-relative" data-tooltip="Proposal censored">
Censored
</span>
{{end}}
{{else if eq (index $.VotesStatus .VoteStatus) "Unauthorized"}}
<span class="text-abandoned position-relative" data-tooltip="Proposal in discussion">
In Discussion
</span>
{{else if eq (len .VoteResults) 0 }}
<span class="text-progress position-relative" data-tooltip="Waiting for administrator approval to start voting">
Vote pending
Expand Down