ソースを参照

Optional close on council motions (#3252)

* Optional close on council motions

* No close available short-circuit
Jaco Greeff 4 年 前
コミット
d35b1a1d10

+ 5 - 0
packages/page-council/src/Motions/Close.tsx

@@ -26,6 +26,11 @@ function Close ({ hasFailed, hash, idNumber, isDisabled, members, proposal }: Pr
   const [accountId, setAccountId] = useState<string | null>(null);
   const [proposalWeight, proposalLength] = useWeight(proposal);
 
+  // protect against older versions
+  if (!api.tx.council.close) {
+    return null;
+  }
+
   return (
     <>
       {isOpen && (

+ 4 - 0
packages/page-tech-comm/src/Proposals/Close.tsx

@@ -26,6 +26,10 @@ function Close ({ hasFailed, hash, idNumber, isDisabled, members, proposal }: Pr
   const [accountId, setAccountId] = useState<string | null>(null);
   const [proposalWeight, proposalLength] = useWeight(proposal);
 
+  if (!api.tx.technicalCommittee.close) {
+    return null;
+  }
+
   return (
     <>
       {isOpen && (

+ 3 - 3
packages/react-hooks/src/useVotingStatus.ts

@@ -37,9 +37,9 @@ function getStatus (api: ApiPromise, bestNumber: BlockNumber, votes: Votes, numM
   return {
     hasFailed,
     hasPassed,
-    isCloseable: api.tx[section].close.meta.args.length === 2
-      ? isEnd
-      : isEnd || hasPassed || hasFailed,
+    isCloseable: api.tx[section].close?.meta.args.length === 4 // current-generation
+      ? isEnd || hasPassed || hasFailed
+      : isEnd,
     isVoteable: !isEnd,
     remainingBlocks: isEnd
       ? null

+ 1 - 1
scripts/ipfsUpload.js

@@ -16,7 +16,7 @@ const DOMAIN = 'dotapps.io';
 const DST = 'packages/apps/build';
 const SRC = 'packages/apps/public';
 const WOPTS = { encoding: 'utf8', flag: 'w' };
-const PINMETA = { name: 'dotapps.io' };
+const PINMETA = { name: DOMAIN };
 
 const repo = `https://${process.env.GH_PAT}@github.com/${process.env.GITHUB_REPOSITORY}.git`;
 const pinata = pinataSDK(process.env.PINATA_API_KEY, process.env.PINATA_SECRET_KEY);