Closed ailisp closed 10 months ago
@frol PTAL. If it looks good, please approve and I'll do the manual migration, then merge PR. Otherwise I'll first address your concerns.
The discussions part is awaiting requirements from Ori. Based on current requirement, my understanding is that's an indexer side thing (people add social db post with extra info to link it to an community, and frontend load these posts rendering in discussion), so won't require changes here.
@elliotBraem I end up rename add_community_announcement to set_community_socialdb, the interface is as you imagined above.
Based on current requirement, my understanding is that's an indexer side thing (people add social db post with extra info to link it to an community, and frontend load these posts rendering in discussion), so won't require changes here.
@ailisp I would just make it part of the UI implementation, so in order to start a discussion:
Near.call('devhub.near', 'add_community_discussion', {"community_handle": "protocol", "social_db_post_reference": ...})
(I did not put too much thought into the naming, please, consider to have better names whenever needed), so it will be a user action to "re-share" the post to community discussions. This will even allow to implement re-sharing the same post to several communities while keeping likes and comments in one place.@ailisp I've been setting up the develop branch for Announcements, it's configured with bodevhub.testnet.
So far, I'm facing an issue where get_all_communities_metadata is giving an error:
near contract call-function as-read-only bodevhub.testnet get_all_communities_metadata json-args {} network-config testnet now
Error:
0: Failed to fetch query for view method: 'get_all_communities_metadata' (contract <bodevhub.testnet> on network <testnet>)
1: Failed to make a view-function call
2: handler error: [Function call returned an error: wasm execution failed with error: HostError(GuestPanic { panic_msg: "Cannot deserialize element" })]
You can see that issue here, as no communities are showing. If it is fixed and contract is upgraded, then this page should successfully show communities. Not sure if it's bad data or something with the PR
Otherwise, creating community is working after attaching 2N and get_community has no issue: see here
@elliotBraem I see what happened. There is a community created before a schema-breaking change. And I forgot to run migration before adding new communities. Let me fix it
UPDATE: fixed. but i cleared the communities. You will need to recreate communities.
Hi @elliotBraem I make some refactors to make the contract work on both mainnet & testnet.
And redeploy a version to bodevhub.testnet & community.bodevhub.testnet. Please test again with frontend.
For your convenience, here is my testing command for create community and add announcement:
near-cli contract call-function as-transaction bodevhub.testnet create_community json-args '{"inputs":{"handle":"zkp5","name":"zeroknowledge","tag":"zerok","description":"aaaaaa","logo_url":"http://example.com","banner_url":"http://example.com","bio_markdown":"bbb"}}' prepaid-gas '50.000 TeraGas' attached-deposit '2 NEAR' sign-as az233.testnet network-config testnet sign-with-macos-keychain send
near-cli contract call-function as-transaction bodevhub.testnet set_community_socialdb json-args '{"handle":"zkp5","data":{"post":{"main":"{\"type\":\"md\",\"text\":\"whats happening\"}"}}}' prepaid-gas '30.000 TeraGas' attached-deposit '0 NEAR' sign-as az233.testnet network-config testnet sign-with-macos-keychain send
It works on manual testing on testnet.
Basically this pr
TODO:
Note: doing migration and self-upgrade community factory similar to main contract should work, but I think it doesn't worth the effort: