Skip to content

Commit

Permalink
Improve invalid script handling (aragon#885)
Browse files Browse the repository at this point in the history
* Description takes precedence in voting card

* Reorder description and metadata (question)

* Do not nullify metadata
  • Loading branch information
2color authored and izqui committed Jun 6, 2019
1 parent 3dbf790 commit 2f9859e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
20 changes: 10 additions & 10 deletions apps/voting/app/src/components/VotePanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,16 @@ const VotePanelContent = React.memo(
</div>
</SidePanelSplit>
<Part>
{description && (
<React.Fragment>
<h2>
<Label>Description</Label>
</h2>
<p>
<VoteText text={description} />
</p>
</React.Fragment>
)}
{metadata && (
<React.Fragment>
<h2>
Expand All @@ -128,16 +138,6 @@ const VotePanelContent = React.memo(
</p>
</React.Fragment>
)}
{description && (
<React.Fragment>
<h2>
<Label>Description</Label>
</h2>
<p>
<VoteText text={description} />
</p>
</React.Fragment>
)}
</Part>
<SidePanelSeparator />
<Part>
Expand Down
2 changes: 1 addition & 1 deletion apps/voting/app/src/components/VotingCard/VotingCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ const VotingCard = React.memo(
<Label>
<Text color={theme.textTertiary}>#{voteId} </Text>
<span>
<VoteText text={metadata || description} />
<VoteText text={description || metadata} />
</span>
</Label>
<VotingOptions options={options} votingPower={votingPower} />
Expand Down
2 changes: 0 additions & 2 deletions apps/voting/app/src/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,6 @@ async function loadVoteDescription(vote) {
} catch (error) {
console.error('Error describing vote script', error)
vote.description = 'Invalid script. The result cannot be executed.'
// Clear metadata so ensure it's rendered with a description rather than question
vote.metadata = null
}

return vote
Expand Down

0 comments on commit 2f9859e

Please sign in to comment.