-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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`
- Loading branch information
Showing
12 changed files
with
141 additions
and
60 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
mod common; | ||
pub use common::{SpaceFollowsProvider, SpacePermissionsProvider}; | ||
pub use common::{SpaceFollowsProvider, SpacePermissionsProvider, ProfileManager}; | ||
|
||
mod moderation; | ||
pub use moderation::{IsAccountBlocked, IsContentBlocked, IsPostBlocked, IsSpaceBlocked}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,31 @@ | ||
#![cfg_attr(not(feature = "std"), no_std)] | ||
|
||
use frame_support::dispatch::DispatchError; | ||
use frame_support::dispatch::{DispatchResult, DispatchError}; | ||
|
||
use crate::SpaceId; | ||
|
||
pub trait SpacePermissionsProvider<SpacePermissionsInfo> { | ||
pub trait SpacePermissionsProvider<AccountId, SpacePermissionsInfo> { | ||
fn space_permissions_info(id: SpaceId) -> Result<SpacePermissionsInfo, DispatchError>; | ||
|
||
fn ensure_space_owner(id: SpaceId, account: &AccountId) -> DispatchResult; | ||
} | ||
|
||
pub trait SpaceFollowsProvider { | ||
type AccountId; | ||
|
||
fn is_space_follower(account: Self::AccountId, space_id: SpaceId) -> bool; | ||
} | ||
|
||
pub trait ProfileManager<AccountId> { | ||
fn profile_space_id(account: &AccountId) -> Option<SpaceId>; | ||
|
||
fn try_set_profile( | ||
account: &AccountId, | ||
space_id: SpaceId, | ||
) -> DispatchResult; | ||
|
||
fn try_reset_profile( | ||
account: &AccountId, | ||
space_id: SpaceId, | ||
) -> DispatchResult; | ||
} |
Oops, something went wrong.