Skip to content

Commit

Permalink
add SendAttachments channel permission
Browse files Browse the repository at this point in the history
  • Loading branch information
ashneverdawn committed Dec 3, 2024
1 parent 6e5ccbe commit b733b0e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
7 changes: 7 additions & 0 deletions extensions/warp-ipfs/src/store/message/community_task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3319,6 +3319,13 @@ impl CommunityTask {
) {
return Err(Error::Unauthorized);
}
if !self.document.has_channel_permission(
own_did,
&CommunityChannelPermission::SendAttachments,
channel_id,
) {
return Err(Error::Unauthorized);
}

let keystore = pubkey_or_keystore(&*self)?;

Expand Down
4 changes: 2 additions & 2 deletions extensions/warp-ipfs/tests/community.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4356,7 +4356,7 @@ mod test {
.revoke_community_channel_permission_for_all(
community.id(),
channel.id(),
CommunityChannelPermission::SendMessages,
CommunityChannelPermission::SendAttachments,
)
.await?;
assert_next_msg_event(
Expand All @@ -4365,7 +4365,7 @@ mod test {
MessageEventKind::RevokedCommunityChannelPermissionForAll {
community_id: community.id(),
channel_id: channel.id(),
permission: CommunityChannelPermission::SendMessages,
permission: CommunityChannelPermission::SendAttachments,
},
)
.await?;
Expand Down
1 change: 1 addition & 0 deletions warp/src/raygun/community.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ pub enum CommunityPermission {
pub enum CommunityChannelPermission {
ViewChannel,
SendMessages,
SendAttachments,
}

#[async_trait::async_trait]
Expand Down

0 comments on commit b733b0e

Please sign in to comment.