Skip to content

Commit a2e795c

Browse files
authored
Merge pull request #3256 from IntersectMBO/develop
2 parents 6aa0b05 + 0278d0e commit a2e795c

File tree

25 files changed

+214
-78
lines changed

25 files changed

+214
-78
lines changed

CHANGELOG.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,22 @@ changes.
1818

1919
### Removed
2020

21-
## [v2.0.17](https://github.com/IntersectMBO/govtool/releases/tag/v2.0.17) 2025-03-18
21+
## [v2.0.18](https://github.com/IntersectMBO/govtool/releases/tag/v2.0.18) 2025-03-20
22+
23+
24+
### Added
25+
26+
- Add redirection to outcomes when proposal is not found [Issue 3230](https://github.com/IntersectMBO/govtool/issues/3230)
27+
28+
### Fixed
2229

30+
- Fix post-vote navigation to governance action list [Issue 3242](https://github.com/IntersectMBO/govtool/issues/3242)
31+
32+
### Changed
33+
34+
### Removed
35+
36+
## [v2.0.17](https://github.com/IntersectMBO/govtool/releases/tag/v2.0.17) 2025-03-18
2337

2438
### Added
2539

govtool/backend/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ FROM $BASE_IMAGE_REPO:$BASE_IMAGE_TAG
44
WORKDIR /src
55
COPY . .
66
RUN cabal build
7-
RUN cp dist-newstyle/build/x86_64-linux/ghc-9.2.7/vva-be-2.0.17/x/vva-be/build/vva-be/vva-be /usr/local/bin
7+
RUN cp dist-newstyle/build/x86_64-linux/ghc-9.2.7/vva-be-2.0.18/x/vva-be/build/vva-be/vva-be /usr/local/bin

govtool/backend/Dockerfile.qovery

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ FROM $BASE_IMAGE_REPO:$BASE_IMAGE_TAG
44
WORKDIR /src
55
COPY . .
66
RUN cabal build
7-
RUN cp dist-newstyle/build/x86_64-linux/ghc-9.2.7/vva-be-2.0.17/x/vva-be/build/vva-be/vva-be /usr/local/bin
7+
RUN cp dist-newstyle/build/x86_64-linux/ghc-9.2.7/vva-be-2.0.18/x/vva-be/build/vva-be/vva-be /usr/local/bin
88

99
# Expose the necessary port
1010
EXPOSE 9876

govtool/backend/src/VVA/API.hs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -283,18 +283,20 @@ getVotes (unHexText -> dRepId) selectedTypes sortMode mSearch = do
283283
CacheEnv {dRepGetVotesCache} <- asks vvaCache
284284
(votes, proposals) <- cacheRequest dRepGetVotesCache dRepId $ DRep.getVotes dRepId []
285285

286-
let voteMap = Map.fromList $ map (\vote@Types.Vote {..} -> (voteProposalId, vote)) votes
287-
288-
processedProposals <- filter (isProposalSearchedFor mSearch) <$> mapSortAndFilterProposals selectedTypes sortMode proposals
289-
286+
let voteMapByTxHash = Map.fromList $
287+
map (\vote -> (pack $ Prelude.takeWhile (/= '#') (unpack $ Types.voteGovActionId vote), vote)) votes
288+
289+
processedProposals <- filter (isProposalSearchedFor mSearch) <$>
290+
mapSortAndFilterProposals selectedTypes sortMode proposals
291+
290292
return $
291293
[ VoteResponse
292294
{ voteResponseVote = voteToResponse vote
293295
, voteResponseProposal = proposalResponse
294296
}
295-
| proposalResponse@ProposalResponse{proposalResponseId} <- processedProposals
296-
, let proposalIdInt = read (unpack proposalResponseId) :: Int
297-
, Just vote <- [Map.lookup (toInteger proposalIdInt) voteMap]
297+
| proposalResponse <- processedProposals
298+
, let txHash = unHexText (proposalResponseTxHash proposalResponse)
299+
, Just vote <- [Map.lookup txHash voteMapByTxHash]
298300
]
299301

300302
drepInfo :: App m => HexText -> m DRepInfoResponse

govtool/backend/src/VVA/DRep.hs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,24 +115,22 @@ getVotes ::
115115
m ([Vote], [Proposal])
116116
getVotes drepId selectedProposals = withPool $ \conn -> do
117117
results <- liftIO $ SQL.query conn getVotesSql (SQL.Only drepId)
118-
118+
119119
if null results
120120
then return ([], [])
121121
else do
122122
let proposalsToSelect = if null selectedProposals
123123
then [ govActionId | (_, govActionId, _, _, _, _, _, _, _) <- results]
124124
else selectedProposals
125-
126125
allProposals <- mapM (Proposal.getProposals . Just . (:[])) proposalsToSelect
127-
128126
let proposals = concat allProposals
129127

130128
let proposalMap = M.fromList $ map (\x -> (proposalId x, x)) proposals
131129

132130
timeZone <- liftIO getCurrentTimeZone
133131

134132
let votes =
135-
[ Vote proposalId' drepId' vote' url' docHash' epochNo' (localTimeToUTC timeZone date') voteTxHash'
133+
[ Vote proposalId' govActionId' drepId' vote' url' docHash' epochNo' (localTimeToUTC timeZone date') voteTxHash'
136134
| (proposalId', govActionId', drepId', vote', url', docHash', epochNo', date', voteTxHash') <- results
137135
, govActionId' `elem` proposalsToSelect
138136
]

govtool/backend/src/VVA/Types.hs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,15 @@ instance Exception AppError
6161

6262
data Vote
6363
= Vote
64-
{ voteProposalId :: Integer
65-
, voteDrepId :: Text
66-
, voteVote :: Text
67-
, voteUrl :: Maybe Text
68-
, voteDocHash :: Maybe Text
69-
, voteEpochNo :: Integer
70-
, voteDate :: UTCTime
71-
, voteTxHash :: Text
64+
{ voteProposalId :: Integer
65+
, voteGovActionId :: Text
66+
, voteDrepId :: Text
67+
, voteVote :: Text
68+
, voteUrl :: Maybe Text
69+
, voteDocHash :: Maybe Text
70+
, voteEpochNo :: Integer
71+
, voteDate :: UTCTime
72+
, voteTxHash :: Text
7273
}
7374

7475
data DRepInfo

govtool/backend/vva-be.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cabal-version: 3.6
22
name: vva-be
3-
version: 2.0.17
3+
version: 2.0.18
44

55
-- A short (one-line) description of the package.
66
-- synopsis:

govtool/frontend/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

govtool/frontend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@govtool/frontend",
33
"private": true,
4-
"version": "2.0.17",
4+
"version": "2.0.18",
55
"type": "module",
66
"scripts": {
77
"build": "vite build",

govtool/frontend/src/components/organisms/DashboardGovernanceActionDetails.tsx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1+
import { useEffect } from "react";
12
import {
23
useNavigate,
34
useLocation,
45
useParams,
56
generatePath,
67
} from "react-router-dom";
78
import { Box, CircularProgress, Link, Typography } from "@mui/material";
9+
import { AxiosError } from "axios";
810

9-
import { ICONS, PATHS } from "@consts";
11+
import { ICONS, OUTCOMES_PATHS, PATHS } from "@consts";
1012
import { useCardano } from "@context";
1113
import {
1214
useGetProposalQuery,
@@ -42,13 +44,24 @@ export const DashboardGovernanceActionDetails = () => {
4244
const shortenedGovActionId =
4345
txHash && getShortenedGovActionId(txHash, +index);
4446

45-
const { data, isLoading } = useGetProposalQuery(
47+
const { data, isLoading, error } = useGetProposalQuery(
4648
fullProposalId ?? "",
4749
!state?.proposal || !state?.vote,
4850
);
4951
const proposal = (data ?? state)?.proposal;
5052
const vote = (data ?? state)?.vote;
5153

54+
useEffect(() => {
55+
const isProposalNotFound =
56+
(error as AxiosError)?.response?.data ===
57+
`Proposal with id: ${fullProposalId} not found`;
58+
if (isProposalNotFound && fullProposalId) {
59+
navigate(
60+
OUTCOMES_PATHS.governanceActionOutcomes.replace(":id", fullProposalId),
61+
);
62+
}
63+
}, [error]);
64+
5265
return (
5366
<Box
5467
px={isMobile ? 2 : 4}

0 commit comments

Comments
 (0)