-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Chore] Tidy up the codebase #56
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm to make sure everything is centre perfectly regardless of the length of the labels might require a re-think of how we layout the elements, which we don't have time for now I think. Switch back to |
* [Spike] Setup `gov-relayer` app (#53) * Add base setup for `gov-relayer` as CLI App * Rename to `proposal-sub` * Start putting things together for `proposal-pub` * Add `proposal-sub` that with new proposal handler * Add requeuing mechanic to the proposal-sub * Fix `lastKnownId` is not updated on the next iteration * Fix compiling error when running `gov-website` and `gov-relayer` on dev * Add basic README details for development * Fix build error * Slim down the `proposal/[pid].tsx` page temporarily to get the build working * Rename `getAMQClient` / `getMDBClient` to `getRabbitClient` and `getMongoClient` * [Spike] Update Discord DM & error messages (#52) * Slight improvement to error messaging * Update discord message * Prefer `response.text()`, fallback to `response.statusText` * [Chore] Tidy up the codebase (#56) * Rename the progress dialog steps * Add check to allow testing the form without having `DISCORD_BOT` defined * Rename to `signAndSend` * Use the new `signAndSend` impl across * Remove `node/models` in favor of `service/mongodb` * Migrate `node/types` to `node/utils` * Migrate `web/types` to `web/utils` * Consolidate all env vars into one service `service/env-vars` * [Hotfix] Wrap error message (#55) * Use `prose` so error text wraps nicely * Apply `prose` to `ProposalNewFormDialog` error message * [Spike] Add proposal activities monitor (#57) * Add `status` as part of the `fetchProposalInfo` * Rename to `gov-relayer:webpack` * Update `waitForBlock` to avoid ignoring the `no-async-promise-executor` rule * Remove the AbortController to make the code looks cleaner with async / await * Add `monitorProposalActivity` to publish `proposal-activity` message * Add `handleProposalActivityMessage` to update Deliberation votes * Add handler for `ReferendumDeliberation` status * [Spike] Add a placeholder for resolving justification content (#58) * Add function to resolve justification content from the Uri * Add comment block * Add `safeFetch` method * Remove the `npm-run-all` as dependency for runtime (#64) Remove the `npm-run-all` as dependency for for runtime * [Spike] Re-style Proposal Single page (#62) * Add `ProposalBody` component and add it to single page view * Add `ProposalSidebar` * Simplify the submit button label * Add `ProposalVoteForm` * Chang FormState.step to `Sign` * Add `useProposalVoteForm` * Add `ProposalVoteFormDialog` * Fix `AccountSelect` doesn't select the initial value * Ensure form is validated before submit the action * Remove `ProposalDetailsDisplay` * Add `votePercentage` and have it synced in the DB * Add `VotesInfo` to `ProposalSidebar` * Add `VetoInfo` * Round up the percentage number * Use `BLOCK_POLLING_INTERVAL` to control the refreshing rate * Make adjustment for smaller viewport * [Fix] Make `resolveProposalJustification` safer with white-listing domains (#66) * [Fix] Remove the `rejectVotes` out of `votePercentage` calculation (#67) * [Spike] Send proposals & referendums to Discord (#60) * Update `env.skel`, tidy up * Port over `getDiscordWebhook` from `gov-services` * Pass `discordWebhook` to `handleProposalActivityMessage` * Port over `getDiscordMessage` from `gov-services` * Update `getDiscordMessage` to work for both Proposals & Referendums * Fetch discord webhook for each channel * Fix logic to pick which `voteFields` are used * Update `DISCORD_RELAYER_BOT` const * Update `ProposalModel` * Fetch discord webhooks and pass to `handleProposalActivityMessage` * Update Discord with votes & status * Prettier format * Refactor * Use `resolveProposalJustification`, resolve circular dependencies * Fix build error * Avoid build fail from bad `justificationUri` * Improve typing for `getDiscordWebhooks` * Refactor sidebar colours, only display `proposalDetails` if they can be fetched successfully * Rename `service/relayer/utils` -> `service/relayer/src` * Update imports * Refactor `getProposalFields` * Prettier format * Temporary fix for `ipfs//` causing `HTTP/400` error and failing build * Fix pinata gateway * Ensure all necessary data is being passed to `getDiscordMessage` * Fetch veto threshold * Pass vote info in case of no change to avoid sending `undefined` to Discord * Display votes as a percentage * Avoid updating Discord message ids with empty string * Get `discordWebhooks` once * Revert to `while` loop * Fix typo * Get different discord message per channel * Prettier format * Refactor / tidy up * Refactor `getProposalEmbed`, `getVoteButton` * Regenerate `service-discord` package using `@nrwl/js` * Only log if update found * Regenerate `service-relayer` library with `@nrwl/js` * Move `DISCORD_` vars to `//DISCORD` partition * Move `assignDiscordRole` to `service-discord` * Check for & reject on `getDiscordBot` error * Update `getDiscordWebhooks` to accept arrays of channel & webhook ids * [Hotfix] Add `discord.js` to `gov-relayer#dependencies` (#69) Add `discord.js` to `gov-relayer#dependencies` * [Spike] Proposal updates (#70) * Extract `getHourInBlocks` to `node-utils` * Add `48 hours` option for `enactmentDelay` * Display `enactmentDelayInHours` on Discord * Add `github.com` into the `justificationUri` white list * Allow certain extrinsics, allow extrinsics that don't require args * Refactor `getProposalFields` * Update `service-relayer` tsconfig * Remove vote button if proposal is not in voting stage * Add `Pending` colour for `ApprovedWaitingEnactment` stage * Refactor `transformFormData` * Display `enactmentDelayInHours` for Proposal single view * [Spike] Omit `system.setCode` args (#75) * Catch error when decoding `setCode` proposal call and define `args` as omitted * Use `toFixed` to round `enactmentDelayInHours` for cases where proposal is submitted through portal * Refactor `call` catch block * Omit args if none, or if `omitted` i.e. for `system.setCode` * Display `omitted` args * Update libs/service/cennznet/src/fetchProposalInfo.ts Co-authored-by: Ken Vu <[email protected]> * Round `enactmentDelayInHours` with `toFixed` Co-authored-by: Ken Vu <[email protected]> * [Hotfix] Avoid property `justificationUri` is undefined error (#77) * Avoid property `justificationUri` is undefined error * Return early if no `justificationUri` * [Fix] Relayer performance issue (#78) * Avoid requeue messages for `proposal-activity` type Since we have to loop through all proposals and check for updates in every 2 blocks anyway * Always create a record first to avoid the same proposal is being processed again * Fix spacing for `update Discord` message * [Fix] Add extra guard to ignore proposals that doesn't have `status` (#80) Add extra guard to ignore building any proposals that doesn't have `status` * [Fix] Add `health check` log (#81) Add `health check` log * [Fix] Styling updates (#84) * Soften the shadow colors on Button and Dialog * Add `favicon` * Add the default meta description * [Fix] API `autoConnect` (#83) Add a regular check to make sure api is connected, if not throw error * [Spike] Proposal changes (#85) * Reduce revalidation time to 5 minutes * Update default function call * Hide `Arguments` section if function call has no arguments * [Spike] Throw `create type` error if not handled (#86) Throw `create type` error if not handled * [Fix] Inactive proposal causes app to crash (#88) * Prevent page crash on inactive proposal * Redirect user to `proposal/new` if their vote causes proposal to end * Fix build error * Add console warning on failure to format `call` * Inform user they will be redirected and why * Return early if `call` is empty * Revert "Redirect user to `proposal/new` if their vote causes proposal to end" This reverts commit 45a84fa. * Don't refetch proposal info if proposal is finalized * Revert "Inform user they will be redirected and why" * [Spike] Use `safeFetch` across code base (#79) Use `safeFetch` across the repo * Add a `proposal-patch <start> <end>` command to patch up DB (#91) * [Spike] Proposal copy & link updates (#92) * Update proposal submission copy * Link directly to appropriate channel after voting * Update env vars * Revert change to `DISCORD_RELAYER_CHANNEL_IDS` * Prettier format * [Spike] Refactor discord messaging (#93) Extract discord messaging to own function * [Chore] Setup GitHub actions (#94) * Add workflow when submit a PR * Fix lint issues * Reset version in `develop` branch * Add `nrwl/nx-set-shas` to make `yarn nx affected` work * Bump to version `v1.1.0` Co-authored-by: Aidan Starke <[email protected]>
Summary
Address issue #26
Changes
DISCORD_BOT
signAndSend
everywherenode/models
in favor ofserivce/mongodb
node/types
andweb/types
tonode/utils
andweb/tils
respectivelyservice/env-vars
Notes
I'm still not very happy with how the env-vars are organised but this will do for now. Would be good to have the
identity/connect
test again to make sure I'm not mucking anything up @aidan-starke