Skip to content

Commit

Permalink
Merge pull request #156 from rmrk-team/bug/152-fix-property-error-mes…
Browse files Browse the repository at this point in the history
…sage

fix set-property error message when no collection
  • Loading branch information
bmacer authored Jun 1, 2022
2 parents 11662cb + 80f0501 commit 0b6b25f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pallets/rmrk-core/src/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ where
value: ValueLimitOf<T>,
) -> DispatchResult {
let collection =
Collections::<T>::get(&collection_id).ok_or(Error::<T>::NoAvailableCollectionId)?;
Collections::<T>::get(&collection_id).ok_or(Error::<T>::CollectionUnknown)?;
ensure!(collection.issuer == sender, Error::<T>::NoPermission);
if let Some(nft_id) = &maybe_nft_id {
// Check NFT lock status
Expand Down
5 changes: 5 additions & 0 deletions pallets/rmrk-core/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1158,6 +1158,11 @@ fn set_property_works() {
let key = stbk("test-key");
// Define property value
let value = stb("test-value");
// set_property fails without a collection (CollectionUnknown)
assert_noop!(
RMRKCore::set_property(Origin::signed(ALICE), 0, Some(0), key.clone(), value.clone()),
Error::<Test>::CollectionUnknown
);
// Create a basic collection
assert_ok!(basic_collection());
// Mint NFT
Expand Down

0 comments on commit 0b6b25f

Please sign in to comment.