Skip to content

feat(gno/daokit): "resource management" handlers#1513

Merged
n0izn0iz merged 4 commits intomainfrom
feat/add-remove-resources
Feb 19, 2025
Merged

feat(gno/daokit): "resource management" handlers#1513
n0izn0iz merged 4 commits intomainfrom
feat/add-remove-resources

Conversation

@Villaquiranm
Copy link
Collaborator

No description provided.

@netlify
Copy link

netlify bot commented Feb 18, 2025

Deploy Preview for teritori-dapp ready!

Name Link
🔨 Latest commit 1aec067
🔍 Latest deploy log https://app.netlify.com/sites/teritori-dapp/deploys/67b567f7183621000845d183
😎 Deploy Preview https://deploy-preview-1513--teritori-dapp.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@netlify
Copy link

netlify bot commented Feb 18, 2025

Deploy Preview for gno-dapp ready!

Name Link
🔨 Latest commit 1aec067
🔍 Latest deploy log https://app.netlify.com/sites/gno-dapp/deploys/67b567f7618bcf00086dac2f
😎 Deploy Preview https://deploy-preview-1513--gno-dapp.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@Villaquiranm Villaquiranm force-pushed the feat/add-remove-resources branch from ecfd37a to a53334b Compare February 18, 2025 17:40
Comment on lines 44 to 56
func NewAddResourceHandler(r *resourcesStore) MessageHandler {
return NewMessageHandler(MsgAddResourceKind, func(ipayload interface{}) {
payload, ok := ipayload.(Resource)
if !ok {
panic(errors.New("invalid payload type"))
}

if getResource(payload.Handler.Type()) != nil {
panic("ressource " + payload.Handler.Type() + " already exists")
}
r.setResource(payload)
})
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
func NewAddResourceHandler(r *resourcesStore) MessageHandler {
return NewMessageHandler(MsgAddResourceKind, func(ipayload interface{}) {
payload, ok := ipayload.(Resource)
if !ok {
panic(errors.New("invalid payload type"))
}
if getResource(payload.Handler.Type()) != nil {
panic("ressource " + payload.Handler.Type() + " already exists")
}
r.setResource(payload)
})
}
func NewSetResourceHandler(r *resourcesStore) MessageHandler {
return NewMessageHandler(MsgSetResourceKind, func(ipayload interface{}) {
payload, ok := ipayload.(Resource)
if !ok {
panic(errors.New("invalid payload type"))
}
r.setResource(payload)
})
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done e31f9e3

@n0izn0iz n0izn0iz changed the title feat: add remove resource feat: "resource management" resources Feb 18, 2025
@n0izn0iz n0izn0iz changed the title feat: "resource management" resources feat(gno/daokit): "resource management" handlers Feb 18, 2025
Copy link
Collaborator

@n0izn0iz n0izn0iz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when we overwrite or remove a resource, we should probably close/remove the proposals that use that resource

@n0izn0iz n0izn0iz merged commit d5c5b1a into main Feb 19, 2025
20 of 24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants