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

Add sudo calls to migrate data in spaces and space-follows pallets #119

Merged

Conversation

F3Joule
Copy link
Member

@F3Joule F3Joule commented Jul 21, 2022

No description provided.

@F3Joule F3Joule self-assigned this Jul 21, 2022
@F3Joule F3Joule requested review from siman and TarekkMA July 21, 2022 09:25
@F3Joule F3Joule mentioned this pull request Jul 21, 2022
6 tasks
@F3Joule F3Joule marked this pull request as ready for review July 22, 2022 14:02
pallets/spaces/src/lib.rs Outdated Show resolved Hide resolved
pallets/spaces/src/lib.rs Outdated Show resolved Hide resolved
pallets/space-follows/src/lib.rs Outdated Show resolved Hide resolved
pallets/spaces/src/lib.rs Outdated Show resolved Hide resolved
@F3Joule F3Joule merged commit fe87802 into dappforce:feature/move-pallets Aug 3, 2022
@F3Joule F3Joule deleted the f3/space-follows-sudo branch August 3, 2022 15:13
F3Joule added a commit that referenced this pull request Aug 9, 2022
* WIP: move traits crate from solochain

* WIP: move permissions pallet from solochain

* WIP: Upgrade `pallet-permission` to the new proc macro

Co-Authored-By: Shady Khalifa <shekohex@gmail.com>

* Make permissions pallet compilable

- Add User structure to parachain-utils
- Make df-traits crate compilable

* WIP: move spaces pallet from solochain

* WIP: Upgrade `pallet-spaces` to the new proc macro

Co-Authored-By: Shady Khalifa <shekohex@gmail.com>

* Make spaces pallet compilable

Add throw_utils_error

* WIP: move profiles pallet from solochain

* Remove profiles struct leaving social account only

* WIP: move space-follows pallet from solochain

* WIP: Upgrade `pallet-space-follows` to the new proc macro

Co-Authored-By: Shady Khalifa <shekohex@gmail.com>

* Make `pallet-space-follows` compilable

* Rearrange `pallet-space-follows` code

* WIP: move roles pallet from solochain

* WIP: upgrade `pallet-roles` to the new proc macro

Co-Authored-By: Shady Khalifa <shekohex@gmail.com>

* WIP: make `pallet-roles` compilable

* Fix `pallet-roles` mocks and tests

* WIP: Move posts pallet from solochain

* WIP Upgrade `pallet-posts` to the new proc macro

Co-Authored-By: Shady Khalifa <shekohex@gmail.com>

* Make `pallet-posts` compilable

* Fix code formatting

* WIP: move space ownership pallet from solochain

* WIP Upgrade `pallet-space-ownership` to the new proc macro

Co-Authored-By: Shady Khalifa <shekohex@gmail.com>

* Make `pallet-space-ownership` compilable

* Fix bug with MaxSpacesPerAccount check

* Rename remove_from_bounded fn

* Fix bug with MaxSpacesPerAccount check

* Fix code formatting

* WIP: move reactions pallet from solochain

* WIP Upgrade `pallet-reactions` to the new proc macro

Co-Authored-By: Shady Khalifa <shekohex@gmail.com>

* Make `pallet-reactions` compilable

* Copy integration-tests from solochain.

* fix cargo

* pallet_utils to pallet_parachain_utils

* mock moderation

* fix construct_runtime style

* remove post/space/profile history

* remove profile follows

* skip reactions/space_ownership for now

* fixes for profile

* fix UtilsError

* import fixes

* fix spaces

* fixed space tests

* enable reactions tests

* space_ownership

* Move social pallets to runtime (#85)

* add missing imports

* fixes to spaces

* add pallets to runtime

* Update node/src/chain_spec.rs

* Update runtime/Cargo.toml

* Fix ordering

* Change pallets ordering in construct_runtime

Co-authored-by: Vlad Proshchavaiev <32250097+F3Joule@users.noreply.github.com>
Co-authored-by: Vladyslav Proshchavaiev <f3joule@gmail.com>

* uncomment update_post_should_work_after_transfer_space_ownership

* Update integration-tests/Cargo.toml

Co-authored-by: Vlad Proshchavaiev <32250097+F3Joule@users.noreply.github.com>

* Update integration-tests/Cargo.toml

Co-authored-by: Vlad Proshchavaiev <32250097+F3Joule@users.noreply.github.com>

* remove deprecated code

* naming changes to MockModeration

* add doc to _default_follow_space

* remove line

* Refactor `pallet-parachain-utils` and `df-traits` to `subsocial-support` (#78)

* Reactor utils and traits to subsocial-support crate

* Fix imports in integration tests

* Do a proper name for a crate

* Fix Error enum in subsocial-support

* Fix runtime

* Change SpacePermissionsProvider fn name

From `get_space` to `space_permissions_info`

* Split `Error` in subsocial-support to a few enums

* Refactor `Content` struct

Remove `Hyper, rename `Raw` to `Other`

* Fix strum dependency in Cargo.toml

* Fix integration tests

* Apply fix suggestions to spaces pallet (#79)

* Refactor spaces pallet code

* Fix code formatting in spaces pallet

* Remove handles and scores from spaces

* Rename some variables

* Fix spaces pallet in a runtime

* Fix formatting manually

* Fix `init_pallet` in `pallet_spaces`

* Make integration tests compile

* Upgrade `pallet-profiles` to the new proc macro (#102)

* Upgrade `pallet-profiles` to the new proc macro

* Update Cargo.lock

* Fix warnings related to profiles pallet upgrade

* Fix Cargo.toml files after merge

Update Cargo.lock

* Fix code formatting in permissions pallet

* fix pallet_profiles in mocks (#116)

* Refactor profiles to spaces as profiles (#106)

* Fix runtime and errors

* Fix integration tests error

* Replace social account with space as profile

* Fix code formatting

* Loose couple profiles with space-ownership

- Profiles and space-ownership aren't more tight coupled
- Rename `ProfileSpaceByAccount` to `ProfileSpaceIdByAccount`
- Add `unset_space_as_profile` extrinsic
- Add `ensure_space_owner` to SpacePermissionsProvider

* Rename extrinsics in profiles pallet

Now two extrinsics to manage profiles are:`set_profile` and `reset_profile`

* Remove redundant counters from Space (#112)

* Remove redundant counters from space

* Fix integration tests

* Merge solochain's profile follows pallet to parachain's profiles (#111)

* WIP: move profile follows pallet from solochain

* Update `profile-follows` to the new proc macro

* Rename profile-follows to account-follows

Add account-follows to runtime

* Refactor posts pallet and remove posts counters in `Space` and `Post` (#117)

* WIP: remove old counters

* WIP: Refactor PostExtension to add counters

- Rename PostExtension::RegularPost -> PostExtension::Post
- Rename PostExtension::SharedPost to PostExtension::SharingPost
- Add PostExtension enum parameters for every variant.
  - Each parameter has case-depending fields, and now, in addition, different counters fields.
- PostExtension::Comment now has `replies_count`
- PostExtension::Post now has `total_replies_count`
- Introduced RepliesCount struct, which as the only `replies_count` field.
- Introduced HasReplies trait, which allows to work with RepliesCount struct.
- Derive Default for PostUpdate instead of implementing it.

* Refactor post counters calculation

- Fix code formatting
- Use proper names for sharing and shared posts
- Rename SharedPostIdsByOriginalPostId -> SharingPostIdsByOriginalPostId

* Fix integration tests after posts refactoring

* Remove score from Post structure

* Rollback redundant HasReplies trait

* Rollback shared post related name changes

* Improve comments related to shared posts

* Rename replies_count to direct_replies_count in Comment

* Remove redundant functions from posts pallet

* Improve docs for counter fields of post

* Fix a few bugs with counters

Update counters for reactions counters on Post

* Remove redundant counters

* Remove let_else feature from tests

* Revert SharedPost enum variant changes

* Swap fields in Comment struct

Co-authored-by: Alex Siman <aleksandr.siman@gmail.com>

* Refactor `updated` fields to be `bool` instead of `Option<WhoAndWhen>` (#118)

* Refactor update field from WhoAndWhen to bool

It's quite redundant to store full update info in a chain storage. We can use off-chain indexer for that. What we really need is just a mark that something was updated.

* Fix integration tests

* Fix a few storages' hashers (#123)

* Add sudo calls to migrate data in spaces and space-follows pallets (#119)

* Add force_create_space to spaces pallet

* Add force_set_next_space_id to spaces pallet

* Add force_follow_space to space-follows pallet

* Add Pays::No on success for spaces sudo calls

* Fix `force_create_space` sudo call

* Fix `force_follow_space` sudo call

* Re-use `add_space_follower` in space-follows sudo

* Fix force_create_space

* Add sudo calls to perform solo- to parachain data migration (#124)

* Add force_follow_account to account-follows pallet

* Add force_set_space_as_profile to profiles pallet

* Add sudo calls for reactions pallet

- `force_crate_reactuib` and `force_set_next_reaction_id` were added

* Add sudo calls for roles pallet

- `force_crate_role`, `force_set_next_role_id` and `force_grant_role` were added

* Add sudo calls for posts pallet

- `force_create_post` and `force_set_next_post_id` were added

* Add preventive logic to force_create_post_reaction

- Clean up a pallet from redundant code

* Add preventive logic to roles pallet sudo calls

- Clean up a pallet from redundant code

* Add preventive logic to posts pallet sudo calls

- Fix roles pallet

* Fix comment

Co-authored-by: Alex Siman <aleksandr.siman@gmail.com>

* Apply suggestions from code review

* Apply suggestions for profiles, roles and reactions

* Fix comment

Co-authored-by: Alex Siman <aleksandr.siman@gmail.com>

* Apply fixes after sudo calls and refactor review (#127)

* Fix namings in profiles pallet

- Fix error name in space-ownership pallet

* Fix space-follows pallet

* Remove parent_id from Space

* Remove auto-follow space when creating it

- Refactor update_space a bit

* Remove PostShared event from posts pallet

- Also remove unused PostDeleted

* Refactor roles pallet

* Fix bug in account-follows sudo call

* Rename updated to edited field

* Fix bugs in posts pallet

- Revert part of update_space refactor

* Apply suggestions from code review

Co-authored-by: Alex Siman <aleksandr.siman@gmail.com>

* Rename who to account in roles events

Co-authored-by: Alex Siman <aleksandr.siman@gmail.com>

* Fix code formatting in social pallets

* Remove redundant parts of code

- Make space-follows Event enum named

* Add parameterized Events enums to all pallets

* Add call filter to disable social pallets (#130)

* Add .git-blame-ignore-revs (#129)

- Ignore code formatting from #125

Co-authored-by: Shady Khalifa <shekohex@gmail.com>
Co-authored-by: Tarek Mohamed Abdalla <tarekkma@gmail.com>
Co-authored-by: Alex Siman <aleksandr.siman@gmail.com>
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.

None yet

3 participants