Skip to content

Commit

Permalink
chore: update community set_metadata_uri fn
Browse files Browse the repository at this point in the history
  • Loading branch information
Darlington02 committed Oct 17, 2024
1 parent 4534390 commit 3e1e5c7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 5 additions & 1 deletion src/community/community.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,11 @@ pub mod CommunityComponent {
ref self: ComponentState<TContractState>, community_id: u256, metadata_uri: ByteArray
) {
let community_owner = self.community_owner.read(community_id);
assert(community_owner == get_caller_address(), NOT_COMMUNITY_OWNER);
assert(
community_owner == get_caller_address()
|| self.is_community_mod(get_caller_address(), community_id),
UNAUTHORIZED
);

let community_details = self.communities.read(community_id);
let updated_community = CommunityDetails {
Expand Down
5 changes: 2 additions & 3 deletions tests/test_community.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,6 @@ fn test_leave_community_emits_event() {
);
}


#[test]
fn test_set_community_metadata_uri() {
let (community_contract_address, _) = __setup__();
Expand All @@ -335,8 +334,8 @@ fn test_set_community_metadata_uri() {
}

#[test]
#[should_panic(expected: ('Karst: Not Community owner',))]
fn test_should_panic_set_community_metadata_uri() {
#[should_panic(expected: ('Karst: user unauthorized!',))]
fn test_should_panic_if_unauthorize_profile_set_community_metadata_uri() {
let (community_contract_address, _) = __setup__();

let communityDispatcher = ICommunityDispatcher { contract_address: community_contract_address };
Expand Down

0 comments on commit 3e1e5c7

Please sign in to comment.