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

chore: Rename space-ownership to ownership #259

Merged
merged 4 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion integration-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ pallet-profiles = { path = '../pallets/profiles', default-features = false }
pallet-reactions = { path = '../pallets/reactions', default-features = false }
pallet-roles = { path = '../pallets/roles', default-features = false }
pallet-space-follows = { path = '../pallets/space-follows', default-features = false }
pallet-ownership = { path = '../pallets/space-ownership', default-features = false }
pallet-ownership = { path = '../pallets/ownership', default-features = false }
pallet-spaces = { path = '../pallets/spaces', default-features = false }
subsocial-support = { path = '../pallets/support', default-features = false }

Expand Down
4 changes: 2 additions & 2 deletions integration-tests/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ frame_support::construct_runtime!(
Reactions: pallet_reactions,
Roles: pallet_roles,
SpaceFollows: pallet_space_follows,
SpaceOwnership: pallet_ownership,
Ownership: pallet_ownership,
Spaces: pallet_spaces,
Domains: pallet_domains,
}
Expand Down Expand Up @@ -217,7 +217,7 @@ pub struct ExtBuilder;
use crate::utils::posts_utils::*;
use crate::utils::spaces_utils::*;
use crate::utils::roles_utils::*;
use crate::utils::space_ownership_utils::*;
use crate::utils::ownership_utils::*;
use crate::utils::reactions_utils::*;
use crate::utils::space_follows_utils::*;

Expand Down
2 changes: 1 addition & 1 deletion integration-tests/src/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ mod spaces;

mod space_follows;

mod space_ownership;
mod ownership;
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@
use frame_support::{assert_ok, assert_noop};
use sp_runtime::traits::Zero;

use pallet_ownership::{OwnableEntity, Error as SpaceOwnershipError};
use pallet_ownership::{OwnableEntity, Error as OwnershipError};
use pallet_spaces::Error as SpacesError;

use crate::mock::*;
use crate::utils::*;
use crate::utils::space_ownership_utils::*;
use crate::utils::ownership_utils::*;

#[test]
fn transfer_space_ownership_should_work() {
ExtBuilder::build_with_space().execute_with(|| {
assert_ok!(_transfer_default_space_ownership()); // Transfer SpaceId 1 owned by ACCOUNT1 to ACCOUNT2

assert_eq!(
SpaceOwnership::pending_ownership_transfer(OwnableEntity::Space(SPACE1)).unwrap(),
Ownership::pending_ownership_transfer(OwnableEntity::Space(SPACE1)).unwrap(),
ACCOUNT2
);
});
Expand Down Expand Up @@ -51,7 +51,7 @@ fn transfer_space_ownership_should_fail_when_trying_to_transfer_to_current_owner
ExtBuilder::build_with_space().execute_with(|| {
assert_noop!(
_transfer_space_ownership(Some(RuntimeOrigin::signed(ACCOUNT1)), None, Some(ACCOUNT1)),
SpaceOwnershipError::<TestRuntime>::CannotTransferToCurrentOwner
OwnershipError::<TestRuntime>::CannotTransferToCurrentOwner
);
});
}
Expand All @@ -70,7 +70,7 @@ fn accept_pending_ownership_should_work() {
assert_eq!(space.owner, ACCOUNT2);

// Check that pending storage is cleared:
assert!(SpaceOwnership::pending_ownership_transfer(OwnableEntity::Space(SPACE1)).is_none());
assert!(Ownership::pending_ownership_transfer(OwnableEntity::Space(SPACE1)).is_none());

assert!(Balances::reserved_balance(ACCOUNT1).is_zero());

Expand All @@ -96,7 +96,7 @@ fn accept_pending_ownership_should_fail_when_no_pending_transfer_for_space() {
ExtBuilder::build_with_space().execute_with(|| {
assert_noop!(
_accept_default_pending_ownership(),
SpaceOwnershipError::<TestRuntime>::NoPendingTransfer
OwnershipError::<TestRuntime>::NoPendingTransfer
);
});
}
Expand All @@ -108,7 +108,7 @@ fn accept_pending_ownership_should_fail_if_origin_is_already_an_owner() {

assert_noop!(
_accept_pending_ownership(Some(RuntimeOrigin::signed(ACCOUNT1)), None),
SpaceOwnershipError::<TestRuntime>::NotAllowedToAcceptOwnershipTransfer,
OwnershipError::<TestRuntime>::NotAllowedToAcceptOwnershipTransfer,
);
});
}
Expand All @@ -120,7 +120,7 @@ fn accept_pending_ownership_should_fail_if_origin_is_not_equal_to_pending_accoun

assert_noop!(
_accept_pending_ownership(Some(RuntimeOrigin::signed(ACCOUNT3)), None),
SpaceOwnershipError::<TestRuntime>::NotAllowedToAcceptOwnershipTransfer
OwnershipError::<TestRuntime>::NotAllowedToAcceptOwnershipTransfer
);
});
}
Expand All @@ -137,7 +137,7 @@ fn reject_pending_ownership_should_work() {
assert_eq!(space.owner, ACCOUNT1);

// Check whether storage state is correct
assert!(SpaceOwnership::pending_ownership_transfer(OwnableEntity::Space(SPACE1)).is_none());
assert!(Ownership::pending_ownership_transfer(OwnableEntity::Space(SPACE1)).is_none());
});
}

Expand All @@ -153,7 +153,7 @@ fn reject_pending_ownership_should_work_when_proposal_rejected_by_current_space_
assert_eq!(space.owner, ACCOUNT1);

// Check whether storage state is correct
assert!(SpaceOwnership::pending_ownership_transfer(OwnableEntity::Space(SPACE1)).is_none());
assert!(Ownership::pending_ownership_transfer(OwnableEntity::Space(SPACE1)).is_none());
});
}

Expand All @@ -172,7 +172,7 @@ fn reject_pending_ownership_should_fail_when_no_pending_transfer_on_space() {
ExtBuilder::build_with_space().execute_with(|| {
assert_noop!(
_reject_default_pending_ownership(),
SpaceOwnershipError::<TestRuntime>::NoPendingTransfer
OwnershipError::<TestRuntime>::NoPendingTransfer
); // Rejecting a transfer from ACCOUNT2
});
}
Expand All @@ -184,7 +184,7 @@ fn reject_pending_ownership_should_fail_when_account_is_not_allowed_to_reject()

assert_noop!(
_reject_pending_ownership(Some(RuntimeOrigin::signed(ACCOUNT3)), None),
SpaceOwnershipError::<TestRuntime>::NotAllowedToRejectOwnershipTransfer
OwnershipError::<TestRuntime>::NotAllowedToRejectOwnershipTransfer
); // Rejecting a transfer from ACCOUNT2
});
}
2 changes: 1 addition & 1 deletion integration-tests/src/tests/posts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use crate::utils::posts_utils::*;
use crate::utils::spaces_utils::*;
use crate::utils::moderation_utils::*;
use crate::utils::roles_utils::*;
use crate::utils::space_ownership_utils::*;
use crate::utils::ownership_utils::*;


#[test]
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/src/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub(crate) mod spaces_utils;
pub(crate) mod permissions_utils;
pub(crate) mod moderation_utils;
pub(crate) mod roles_utils;
pub(crate) mod space_ownership_utils;
pub(crate) mod ownership_utils;
pub(crate) mod reactions_utils;
pub(crate) mod space_follows_utils;
pub(crate) mod posts_utils;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub(crate) fn _transfer_space_ownership(
space_id: Option<SpaceId>,
transfer_to: Option<AccountId>,
) -> DispatchResult {
SpaceOwnership::transfer_ownership(
Ownership::transfer_ownership(
origin.unwrap_or_else(|| RuntimeOrigin::signed(ACCOUNT1)),
space_id.map_or(OwnableEntity::Space(SPACE1), |id| OwnableEntity::Space(id)),
transfer_to.unwrap_or(ACCOUNT2),
Expand All @@ -33,7 +33,7 @@ pub(crate) fn _accept_default_pending_ownership() -> DispatchResult {
}

pub(crate) fn _accept_pending_ownership(origin: Option<RuntimeOrigin>, space_id: Option<SpaceId>) -> DispatchResult {
SpaceOwnership::accept_pending_ownership(
Ownership::accept_pending_ownership(
origin.unwrap_or_else(|| RuntimeOrigin::signed(ACCOUNT2)),
space_id.map_or(OwnableEntity::Space(SPACE1), |id| OwnableEntity::Space(id)),
)
Expand All @@ -48,7 +48,7 @@ pub(crate) fn _reject_default_pending_ownership_by_current_owner() -> DispatchRe
}

pub(crate) fn _reject_pending_ownership(origin: Option<RuntimeOrigin>, space_id: Option<SpaceId>) -> DispatchResult {
SpaceOwnership::reject_pending_ownership(
Ownership::reject_pending_ownership(
origin.unwrap_or_else(|| RuntimeOrigin::signed(ACCOUNT2)),
space_id.map_or(OwnableEntity::Space(SPACE1), |id| OwnableEntity::Space(id)),
)
Expand Down
2 changes: 1 addition & 1 deletion pallets/creator-staking/src/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ impl<T: Config> Pallet<T> {

/// Implementation of `CreatorStakingProvider` for `creator-staking` pallet.
///
/// This is used in space-ownership pallet to forbid ownership transfer for spaces, which
/// This is used in ownership pallet to forbid ownership transfer for spaces, which
/// are registered as creators.
impl<T: Config> CreatorStakingProvider<T::AccountId> for Pallet<T> {
fn is_creator_active(
Expand Down
File renamed without changes.
File renamed without changes.
Loading
Loading