Skip to content
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

Autogenerate stakeholder group #7005

Merged
merged 44 commits into from
Mar 26, 2024
Merged

Conversation

rbennettcw
Copy link
Contributor

@rbennettcw rbennettcw commented Mar 6, 2024

Link to Issue

Closes: #6843
Closes: #7001

Description of Changes

  • Adds script to generate stakeholder group for existing staked communities
  • Implements policy to autogenerate stakeholder group when a stake is enabled on a community
  • Splits out searchProfiles into 2 separate routes: the original route + a new route specifically for "community members"
    • Main reason is due to performance– the original route is more performant and used for search bar while the new route is for the members page and includes groups, staked balances, etc.
  • Adds "Stake" column to members page UI

Test Plan

  • CA Testing
    • Run migration
    • Create a staked community
    • Buy some stake
    • Go to members page, confirm that your profile shows with Stakeholder label and stake amount visible
    • Go to groups page, confirm that Stakeholder group exists
    • In DB, delete the stakeholder group, then from packages/scripts, run yarn generate-stakeholder-groups
      • Confirm that the stakeholder group is recreated

Deployment Plan

  • From the packages/scripts directory, run yarn add ts-node tsconfig-paths && yarn generate-stakeholder-groups to create stakeholder groups for existing staked communities

Other Considerations

  • The chosen implementation is the simplest, but comes at the cost of performance. It must fetch all members of the community and their stake balances even though the request is paginated. This is necessary because stake balances are fetched from onchain, and must be sorted in memory.

@rbennettcw rbennettcw marked this pull request as ready for review March 8, 2024 22:53
@kurtisassad
Copy link
Contributor

E2E test failure was due to regression in master. If you merge latest master it should be fixed.

Copy link
Collaborator

@jnaviask jnaviask left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to infinite loop on /ddd/trpc/thread.getBulkThreads,thread.getBulkThreads?batch=1&input=%7B%220%22%3A%7B%22community_id%22%3A%22rugpull-support-group%22%2C%22queryType%22%3A%22bulk%22%2C%22limit%22%3A20%2C%22includePinnedThreads%22%3Atrue%2C%22toDate%22%3A%222024-03-14T19%3A23%3A19.117Z%22%2C%22fromDate%22%3Anull%2C%22isOnArchivePage%22%3Afalse%2C%22cursor%22%3A379%7D%2C%221%22%3A%7B%22community_id%22%3A%22rugpull-support-group%22%2C%22queryType%22%3A%22bulk%22%2C%22limit%22%3A20%2C%22includePinnedThreads%22%3Atrue%2C%22toDate%22%3A%222024-03-14T19%3A23%3A19.117Z%22%2C%22fromDate%22%3Anull%2C%22isOnArchivePage%22%3Afalse%2C%22cursor%22%3A379%7D%7D when I access http://localhost:8080/rugpull-support-group/discussions

?

@jnaviask jnaviask dismissed their stale review March 15, 2024 15:03

unrelated

rbennettcw and others added 3 commits March 20, 2024 15:28
* stakeholder ddd script wip

* move scripts to packages dir

* ddd command wip

* tsconfig and script update

* script fixes

* further script fixes wip

* update dump-db (#7113)

* 7136 infiniteloopbug (#7138)

* Fixed overflow issue

* Fixed z-index

* Fixes loop

* cleanup

* Fix one off dynos (#7133)

* move ts-node and tsconfig-paths to dep

* yarn.lock fix

* add -T option for ts-node scripts + clean-up package.json scripts

* Fixed issue with getBulkThreads (#7148)

* fix ddd wip

* snapshot message now changes when space is changed in dropdown (#7007)

* snapshot message now changes when space is changed in dropdown

* deleted commented out code

* deleted console log

* refactored code to not be redundant

* destructured props to pass tests and clean up codebase

* include rawLog in UI error (#7156)

* Discord Bot Disconnect (#7144)

* discord disconnect route + add admin check for setConfig

* return response + fix eslint errors

* fix redirect + removal + setting

* eslint

* eslint

* ensure delete + refresh renders integration as deleted

* eslint

* move API request to /state (react-query) + use useMemo to fetch urlSearchParams

* is disconnecting text

* eslint

* move path to ApiEndpoints

* Implement a deep seed util for unit testing (#7139)

* deep seed

* keep seedDb as legacy, fix new tests with seed

* clean seeds

* fix test

* fix lint

* remove comments

* remove toJSON

* remove magic db name and fix comments

---------

Co-authored-by: rotorsoft <[email protected]>

* Broker Port (#7039)

* rabbitmq adapter

* snapshot consumer broker + event handling updates

* discordConsumer

* discordConsumer update + commonwealthConsumer fixes

* fix some types

* Discord listener message publishing

* Snapshot producer updates

* Remove old RabbitMQ controller + associated types

* unit tests + RabbitMQAdapter updates + Discord message event schema fix

* RMQ URL

* fix test

* merge resolution

* type fixes

---------

Co-authored-by: rotorsoft <[email protected]>

* Deprecate custom support for Axie Infinity forum. (#7159)

* Deprecate custom support for Axie Infinity forum.

* Update migration to select correct eth chain node.

* added snapshot link value in breadcrumbs/utils (#7163)

* this should force prettier to fail on our branch... (#7118)

* this should force prettier to fail on our branch...

* fixed yarn.lock issue.

* I don't think we were running all the rules before - at least on MacOS but this should fix it.

* prettier fix... (#7177)

* prettier fix...

* turn prettier to warn...

* jQuery removal (#7162)

* remove jquery from login

* remove jquery from web_wallets

* remove jquery from coinbase_web_wallet and metamask_web_wallet

* remove jquery from contracts

* remove jquery from polls

* remove jquery from user

* remove jquery account

* remove jquery from components

* remove jquery from delete_address_modal

* remove jquery from notifications

* remove jquery from dependencies

* removed dead code

---------

Co-authored-by: Jake Naviasky <[email protected]>

* fix tests (#7175)

Co-authored-by: rotorsoft <[email protected]>

* Fix snapshot tests (#7143)

* fix snapshot tests

* add snapshot tests to CI

* add test step to CI

* update path

* update path

* set node version

* remove `main` and add `private` in snapshot package.json

* add type check for snapshot-listener

* install deps

* try `yarn build-ci` to resolve CI bug

* try building only snapshot before testing

* use in-memory broker for tests

* broker port merge resolution

* Add libs tests to CI (#7174)

* Add libs tests to CI

* Fixed PR comment

* 7136 infiniteloopbug taketwo (#7150)

* Fixed overflow issue

* Fixed z-index

* Fix

* CLG

* Removed useEffect

* Got rid of params useBrowserWindow

* CR

* Fix for topic loading.  Types are wrong. (#7153)

* This is a HACKED fix for topic loading.  The types are wrong and we're sending them to the backend incorrectly

* In theory this should fix the loading issue...

* this might be the proper fix but could be a different issue.

* trigger CI

* Fixes Z-Index for CWModal (#7166)

* fix types and imports

* fix types

* Create Outbox (#7044)

* Outbox table migration

* auto trigger maintenance

* archive-outbox script + bump @types/node

* dockerfile for postgres and pg_partman extension + remove old docker file

* new docker file

* update installation

* update installation

* update

* test another docker file

* outbox sequelize model + zod schema

* update

* Fixed docker file

* working Docker file

* remove user 1001

* create extension if exist + use cw_postgres image in CI

* update pg_partman interval

* update pg_partman type

* update outbox sequelize model

* remove id column from sequelize model definition

* archive-outbox updates

* package.json script for outbox archival

* use npx

* add -T option for archival-outbox yarn script

* logging

* load env var with dotenv

* modify dump name

* fix searching AWS for existing object

* merge conflict resolution

* fix import

* fix another import

* remove unnecessary comments

* Outbox hardcode event_name + event_payload schema

* Trigger CI

---------

Co-authored-by: kassad <[email protected]>

* Fix CI (#7178)

* Trigger CI

* fix CI

* add RMQ to CI

* use common_test in CI

* add test db to sequelize.json

* add NODE_ENV=test to `build-ci` migrate-db command

* load env var in database.ts

* use common_test DB for all CI jobs

* remove TaggedThreads model + set selected_community_id = null for test Users (resolves fkey issue)

* remove TaggedThreads model + set selected_community_id = null for test Users (resolves fkey issue)

* fix model test

* fix CommunityStakes model

* Postgresql numberic = Sequelize DECIMAL

* revert some changes

* update vote weight data type

* increase snapshot timeout

* revert checkDb uri update

* move getCommunityMembers query

* trpc router

* Fix thread reaction count update (#7171)

* query fix + script fix

* fix query output wip

* Added 'My Community Stake' option in profile dropdown (#7189)

* Added 'My Community Stake' option in profile dropdown

* Updated to use `useFlag` for .env flag check

* use trpc for members fetch

* add stake balance in UI

* fix non-staked members page

---------

Co-authored-by: Timothee Legros <[email protected]>
Co-authored-by: Zachary Lee <[email protected]>
Co-authored-by: Kurtis Assad <[email protected]>
Co-authored-by: Israel Lund <[email protected]>
Co-authored-by: Mark Hagelberg <[email protected]>
Co-authored-by: Roger Torres <[email protected]>
Co-authored-by: rotorsoft <[email protected]>
Co-authored-by: Jake Naviasky <[email protected]>
Co-authored-by: Kevin Burton <[email protected]>
Co-authored-by: Marcin Maslanka <[email protected]>
Co-authored-by: Malik Zulqurnain <[email protected]>
@rbennettcw
Copy link
Contributor Author

This PR now includes both the backend and frontend changes + DDD refactor.

@rbennettcw rbennettcw marked this pull request as draft March 25, 2024 16:12
@rbennettcw rbennettcw marked this pull request as ready for review March 25, 2024 20:11
Copy link
Contributor

@Rotorsoft Rotorsoft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@rbennettcw rbennettcw merged commit d320853 into master Mar 26, 2024
7 of 8 checks passed
@rbennettcw rbennettcw deleted the ryan/autogen-stakeholder-group branch March 26, 2024 02:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add stake balance to members list (UI) Autogenerate stakeholder group
4 participants