Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ changes.
### Changed

- Exclude network total stake and info from network metrics [Issue 3189](https://github.com/IntersectMBO/govtool/issues/3189)
- Change restriction level for re-voting on governance actions [Issue 3191](https://github.com/IntersectMBO/govtool/issues/3191)

### Removed

Expand Down
37 changes: 21 additions & 16 deletions govtool/backend/sql/get-votes.sql
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
select DISTINCT ON (voting_procedure.gov_action_proposal_id, voting_procedure.drep_voter) voting_procedure.gov_action_proposal_id, concat(encode(gov_action_tx.hash,'hex'),'#',gov_action_proposal.index), encode(drep_hash.raw, 'hex'), voting_procedure.vote::text, voting_anchor.url, encode(voting_anchor.data_hash, 'hex'), block.epoch_no as epoch_no, block.time as time, encode(vote_tx.hash, 'hex') as vote_tx_hash
from voting_procedure
join gov_action_proposal
on gov_action_proposal.id = voting_procedure.gov_action_proposal_id
join drep_hash
on drep_hash.id = voting_procedure.drep_voter
left join voting_anchor
on voting_anchor.id = voting_procedure.voting_anchor_id
join tx as gov_action_tx
on gov_action_tx.id = gov_action_proposal.tx_id
join tx as vote_tx
on vote_tx.id = voting_procedure.tx_id
join block
on block.id = vote_tx.block_id
where drep_hash.raw = decode(?, 'hex')
order by voting_procedure.gov_action_proposal_id, voting_procedure.drep_voter, voting_procedure.id desc
SELECT DISTINCT ON (voting_procedure.gov_action_proposal_id, voting_procedure.drep_voter)
voting_procedure.gov_action_proposal_id,
CONCAT(encode(gov_action_tx.hash,'hex'),'#',gov_action_proposal.index),
encode(drep_hash.raw, 'hex'),
LOWER(voting_procedure.vote::text),
voting_anchor.url,
encode(voting_anchor.data_hash, 'hex'),
block.epoch_no AS epoch_no,
block.time AS time,
encode(vote_tx.hash, 'hex') AS vote_tx_hash
FROM voting_procedure
JOIN gov_action_proposal
ON gov_action_proposal.id = voting_procedure.gov_action_proposal_id
JOIN drep_hash
ON drep_hash.id = voting_procedure.drep_voter
LEFT JOIN voting_anchor ON voting_anchor.id = voting_procedure.voting_anchor_id
JOIN tx AS gov_action_tx ON gov_action_tx.id = gov_action_proposal.tx_id
JOIN tx AS vote_tx ON vote_tx.id = voting_procedure.tx_id
JOIN block ON block.id = vote_tx.block_id
WHERE drep_hash.raw = decode(?, 'hex')
ORDER BY voting_procedure.gov_action_proposal_id, voting_procedure.drep_voter, voting_procedure.id DESC
7 changes: 5 additions & 2 deletions govtool/frontend/src/components/molecules/VoteActionForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ export const VoteActionForm = ({
const {
areFormErrors,
confirmVote,
isDirty,
isVoteLoading,
registerInput,
setValue,
Expand Down Expand Up @@ -350,7 +349,11 @@ export const VoteActionForm = ({
data-testid="vote-button"
variant="contained"
disabled={
!vote || previousVote?.vote === vote || (areFormErrors && isDirty)
!vote ||
areFormErrors ||
(previousVote?.vote === vote &&
(previousVote.metadataHash === voteContextHash ||
!voteContextHash))
}
isLoading={isVoteLoading}
onClick={confirmVote}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ export const VoteContextText = ({
const isContinueDisabled = !watch("voteContextText");

const fieldProps = {
key: "voteContextText",
layoutStyles: { mb: 3 },
name: "voteContextText",
placeholder: t("govActions.provideContext"),
Expand Down Expand Up @@ -70,6 +69,7 @@ export const VoteContextText = ({
<ControlledField.TextArea
{...{ control, errors }}
{...fieldProps}
key="voteContextText"
isModifiedLayout
maxLength={MAX_LENGTH}
data-testid="provide-context-input"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,5 @@ export const getVoteContextTextFromFile = async (url: string | undefined) => {

const response = await axios.get(url);

const voteContextText =
response.data.body["CIP108:voteContextText"]["@value"];

return voteContextText;
return response.data.body?.body?.comment ?? "";
};