Skip to content

Commit

Permalink
ticketvote: Fix status change validation bug.
Browse files Browse the repository at this point in the history
This commit skips the vote metadata validation if the record is being
censored or abandoned. It does not matter if fields have become outdated,
such as the linkby deadline, if the record is not being made public.
  • Loading branch information
lukebp committed Nov 18, 2021
1 parent 3b77a6b commit 3dbe4e3
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions politeiad/backendv2/tstorebe/plugins/ticketvote/hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,13 @@ func (p *ticketVotePlugin) voteMetadataVerifyOnEdits(r backend.Record, newFiles
// voteMetadataVerifyOnStatusChange runs vote metadata validation that is
// specific to record status changes.
func (p *ticketVotePlugin) voteMetadataVerifyOnStatusChange(status backend.StatusT, files []backend.File) error {
// If the record is being censored or archived then this
// vote metadata validation doesn't matter.
switch status {
case backend.StatusCensored, backend.StatusArchived:
return nil
}

// Decode vote metadata. Vote metadata is optional so one may not
// exist.
vm, err := voteMetadataDecode(files)
Expand Down

0 comments on commit 3dbe4e3

Please sign in to comment.