Skip to content

Commit

Permalink
Use endDate when DEFEATED before gasless election
Browse files Browse the repository at this point in the history
  • Loading branch information
selankon committed Jan 26, 2024
1 parent a1993cf commit c2ea5ee
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/pages/proposal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {useEditor} from '@tiptap/react';
import StarterKit from '@tiptap/starter-kit';
import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react';
import {useTranslation} from 'react-i18next';
import {generatePath, useNavigate, useParams, Link} from 'react-router-dom';
import {generatePath, Link, useNavigate, useParams} from 'react-router-dom';
import sanitizeHtml from 'sanitize-html';
import styled from 'styled-components';

Expand Down Expand Up @@ -692,6 +692,16 @@ export const Proposal: React.FC = () => {
? t('votingTerminal.status.ineligibleWhitelist')
: undefined;

let proposalStateEndate = proposal?.endDate;
// If is gasless proposal and is defeated because is not approved, but the offchain election passed, use the tally end date
if (
proposal &&
isGaslessProposal(proposal) &&
proposal.status === ProposalStatus.DEFEATED &&
proposal.canBeApproved // Offchain election passed
) {
proposalStateEndate = proposal.tallyEndDate;
}
// status steps for proposal
const proposalSteps = proposal
? getProposalStatusSteps(
Expand All @@ -700,7 +710,7 @@ export const Proposal: React.FC = () => {
pluginType,
proposal.startDate,
// If is gasless the proposal ends after the expiration period
isGaslessProposal(proposal) ? proposal.tallyEndDate : proposal.endDate,
proposalStateEndate!,
proposal.creationDate,
proposal.creationBlockNumber
? NumberFormatter.format(proposal.creationBlockNumber)
Expand Down

0 comments on commit c2ea5ee

Please sign in to comment.