votehf
6 лет назад[CLOSED] Add comment on reblog in follow-plugin #758
https://github.com/GolosChain/golos/issues/758
Checklist:
- Create 3 accounts and a comment to reblog:
./cli_wallet --server-rpc-endpoint=ws://127.0.0.1:8091
set_password qwer
unlock qwer
import_key 5JVFFWRLwz6JoP9kguuRFfytToGU6cLgBVTL9t6NB3D3BQLbUBS
create_account cyberfounder test "{}" "30.000 GOLOS" true
transfer_to_vesting cyberfounder test "30.000 GOLOS" true
post_comment test test "" test hello world "{}" true
create_account cyberfounder testreb "{}" "30.000 GOLOS" true
transfer_to_vesting cyberfounder testreb "30.000 GOLOS" true
create_account cyberfounder testreb2 "{}" "30.000 GOLOS" true
transfer_to_vesting cyberfounder testreb2 "30.000 GOLOS" true
- Follow on future rebloggers (need for feed_objects):
begin_builder_transaction
add_operation_to_builder_transaction 0 ["custom_json", {"required_posting_auths":["test"],"id": "follow", "json":"[\"follow\", {\"follower\":\"test\",\"following\":\"testreb\",\"what\":[\"blog\"]}]"}]
sign_builder_transaction 0 true
begin_builder_transaction
add_operation_to_builder_transaction 1 ["custom_json", {"required_posting_auths":["test"],"id": "follow", "json":"[\"follow\", {\"follower\":\"test\",\"following\":\"testreb2\",\"what\":[\"blog\"]}]"}]
sign_builder_transaction 1 true
- Reblog
begin_builder_transaction
add_operation_to_builder_transaction 2 ["custom_json", {"required_posting_auths":["testreb"],"id": "follow", "json":"[\"reblog\", {\"account\":\"testreb\",\"author\":\"test\",\"permlink\":\"test\",\"title\":\"hello\",\"body\":\"world\",\"json_metadata\":\"{}\"}]"}]
sign_builder_transaction 2 true
begin_builder_transaction
add_operation_to_builder_transaction 3 ["custom_json", {"required_posting_auths":["testreb2"],"id": "follow", "json":"[\"reblog\", {\"account\":\"testreb2\",\"author\":\"test\",\"permlink\":\"test\",\"title\":\"hello2\",\"body\":\"world2\"}]"}]
sign_builder_transaction 3 true
- Check blog_index.
</script><script src="node_modules/golos-js/dist/golos.min.js"></script>
Hello world
<script>
golos.config.set('websocket', 'ws://127.0.0.1:8091');
var logger = function(err, result) { console.log(err, result); };
golos.api.getBlog("test", 0, 300, function (err, result) {
document.body.innerHTML += '<pre>' + JSON.stringify(result, null, 2) + "</pre>";
});
golos.api.getBlog("testreb", 0, 300, function (err, result) {
document.body.innerHTML += '<pre>' + JSON.stringify(result, null, 2) + "</pre>";
});
golos.api.getBlog("testreb2", 0, 300, function (err, result) {
document.body.innerHTML += '<pre>' + JSON.stringify(result, null, 2) + "</pre>";
});
</script>
Result: 3 blogs - by test, testreb, testreb2.
testreb's and testreb2's blogs have title
and body
fields. Second has empty json_metadata
field.
Also, try getBlogEntries
- result should be same.
- Check feed_index:
<script src="node_modules/golos-js/dist/golos.min.js"></script>
Hello world
<script>
golos.config.set('websocket', 'ws://127.0.0.1:8091');
var logger = function(err, result) { console.log(err, result); };
golos.api.getFeed("test", 0, 300, function (err, result) {
document.body.innerHTML = '<pre>' + JSON.stringify(result, null, 2) + "</pre>";
});
Result: feed_object with testreb and testreb2 in reblog_by
field, and with reblog_entries
field with 2 reblog entries.
Also, try getFeedEntries
- result should be same.
- Check get_discussions_by_blog:
<script src="node_modules/golos-js/dist/golos.min.js"></script>
Hello world
<script>
golos.config.set('websocket', 'ws://127.0.0.1:8091');
var logger = function(err, result) { console.log(err, result); };
golos.api.getDiscussionsByBlog({select_authors: ["test"], limit: 100}, function (err, result) {
document.body.innerHTML = '<pre>' + JSON.stringify(result, null, 2) + "</pre>";
});
Result: discussion with reblog entry.
- Check get_discussions_by_feed:
<script src="node_modules/golos-js/dist/golos.min.js"></script>
Hello world
<script>
golos.config.set('websocket', 'ws://127.0.0.1:8091');
var logger = function(err, result) { console.log(err, result); };
golos.api.getDiscussionsByFeed({select_authors: ["test"], limit: 100}, function (err, result) {
document.body.innerHTML = '<pre>' + JSON.stringify(result, null, 2) + "</pre>";
});
Result: discussion with reblog entries.