Skip to content

Commit

Permalink
Add REACT/REPLY permission (#340)
Browse files Browse the repository at this point in the history
Add REACT_REPLY and cause client to locally evaluate xchain entitlements
for REACT_REPLY along with channel READ and WRITE.
  • Loading branch information
clemire authored Jul 4, 2024
1 parent 276e0bc commit 9b1bfab
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions contracts/src/spaces/facets/Permissions.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ library Permissions {
string public constant ModifyBanning = "ModifyBanning";
string public constant Read = "Read";
string public constant Write = "Write";
string public constant ReactReply = "ReactReply";
string public constant Ping = "Ping";
}
4 changes: 4 additions & 0 deletions core/node/auth/permissions.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const (
PermissionPinMessages
PermissionAddRemoveChannels
PermissionModifySpaceSettings
PermissionReactReply
)

func (p Permission) String() string {
Expand All @@ -37,6 +38,9 @@ func (p Permission) String() string {
return "AddRemoveChannels"
case PermissionModifySpaceSettings:
return "ModifySpaceSettings"
case PermissionReactReply:
return "ReactReply"

default:
return "Unknown"
}
Expand Down
1 change: 1 addition & 0 deletions packages/web3/src/ContractTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export const Permission = {
PinMessage: 'PinMessage',
AddRemoveChannels: 'AddRemoveChannels',
ModifySpaceSettings: 'ModifySpaceSettings',
ReactReply: 'ReactReply',
} as const

export type Permission = (typeof Permission)[keyof typeof Permission]
Expand Down
6 changes: 5 additions & 1 deletion packages/web3/src/v3/SpaceDapp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,11 @@ export class SpaceDapp implements ISpaceDapp {
? channelNetworkId
: `0x${channelNetworkId}`

if (permission === Permission.Read || permission === Permission.Write) {
if (
permission === Permission.Read ||
permission === Permission.Write ||
permission === Permission.ReactReply
) {
const linkedWallets = await this.getLinkedWallets(user)

const owner = await space.Ownable.read.owner()
Expand Down

0 comments on commit 9b1bfab

Please sign in to comment.