diff --git a/hive/db/sql_scripts/hive_post_operations.sql b/hive/db/sql_scripts/hive_post_operations.sql index 6c91e6ce5690ce09ca5d2efe3bdf97c3b2159750..9c29e9ccf2eddc72958ce5c26b16d1b67bb3c898 100644 --- a/hive/db/sql_scripts/hive_post_operations.sql +++ b/hive/db/sql_scripts/hive_post_operations.sql @@ -48,21 +48,23 @@ BEGIN ELSE IF _community_id IS NOT NULL THEN SELECT type_id INTO __community_type_id FROM hivemind_app.hive_communities WHERE id = _community_id; + __community_id = _community_id; ELSE SELECT type_id, id INTO __community_type_id, _community_id from hivemind_app.hive_communities where name = _community_name; + __community_id = _community_id; END IF; IF __community_type_id = __community_type_topic THEN - __is_muted := TRUE; + __is_muted := FALSE; ELSE IF __community_type_id = __community_type_journal AND is_comment = TRUE THEN - __is_muted := TRUE; + __is_muted := FALSE; ELSE select role_id into __role_id from hivemind_app.hive_roles where hivemind_app.hive_roles.community_id = _community_id AND account_id = _author_id; IF __community_type_id = __community_type_journal AND is_comment = FALSE AND __role_id IS NOT NULL AND __role_id >= __member_role THEN - __is_muted := TRUE; + __is_muted := FALSE; ELSIF __community_type_id = __community_type_council AND __role_id IS NOT NULL AND __role_id >= __member_role THEN - __is_muted := TRUE; + __is_muted := FALSE; END IF; END IF; END IF; @@ -122,7 +124,7 @@ if _parent_author != '' THEN _block_num as block_num, _block_num as block_num_created FROM hivemind_app.hive_accounts ha, hivemind_app.hive_permlink_data hpd, - hivemind_app.process_community_post(_block_num, _community_support_start_block, NULL, _parent_permlink, ha.id, false) pcp, + hivemind_app.process_community_post(_block_num, _community_support_start_block, NULL, _parent_permlink, ha.id, TRUE) pcp, hivemind_app.hive_posts php INNER JOIN hivemind_app.hive_accounts pha ON pha.id = php.author_id INNER JOIN hivemind_app.hive_permlink_data phpd ON phpd.id = php.permlink_id diff --git a/tests/api_tests/hivemind/tavern/bridge_api_patterns/get_community/hive-211119.pat.json b/tests/api_tests/hivemind/tavern/bridge_api_patterns/get_community/hive-211119.pat.json index 52be3f016a295ba5faa942ec4b4a6ce24e917190..503953b63b10981713054d5dd053cb810006b165 100644 --- a/tests/api_tests/hivemind/tavern/bridge_api_patterns/get_community/hive-211119.pat.json +++ b/tests/api_tests/hivemind/tavern/bridge_api_patterns/get_community/hive-211119.pat.json @@ -5,14 +5,14 @@ "created_at": "2016-09-15 19:47:51", "description": "", "flag_text": "", - "id": 92531, + "id": 92532, "is_nsfw": false, "lang": "en", "name": "hive-211119", "num_authors": 0, "num_pending": 0, "settings": {}, - "subscribers": 0, + "subscribers": 1, "sum_pending": 0, "team": [ [ @@ -23,4 +23,4 @@ ], "title": "@hive-211119", "type_id": 2 -} \ No newline at end of file +} diff --git a/tests/api_tests/hivemind/tavern/bridge_api_patterns/get_community/hive-311119.pat.json b/tests/api_tests/hivemind/tavern/bridge_api_patterns/get_community/hive-311119.pat.json index d7afb782f744beda2804fe425570bf75fe11f9ba..f3a97346b60230ca85de47e36062c16cc8c1c9f1 100644 --- a/tests/api_tests/hivemind/tavern/bridge_api_patterns/get_community/hive-311119.pat.json +++ b/tests/api_tests/hivemind/tavern/bridge_api_patterns/get_community/hive-311119.pat.json @@ -1,26 +1,26 @@ { - "about": "", - "avatar_url": "", - "context": {}, - "created_at": "2016-09-15 19:47:51", - "description": "", - "flag_text": "", - "id": 92532, - "is_nsfw": false, - "lang": "en", - "name": "hive-311119", - "num_authors": 0, - "num_pending": 0, - "settings": {}, - "subscribers": 0, - "sum_pending": 0, - "team": [ - [ - "hive-311119", - "owner", - "" - ] - ], - "title": "@hive-311119", - "type_id": 3 + "about": "", + "avatar_url": "", + "context": {}, + "created_at": "2016-09-15 19:47:51", + "description": "", + "flag_text": "", + "id": 92533, + "is_nsfw": false, + "lang": "en", + "name": "hive-311119", + "num_authors": 0, + "num_pending": 0, + "settings": {}, + "subscribers": 1, + "sum_pending": 0, + "team": [ + [ + "hive-311119", + "owner", + "" + ] + ], + "title": "@hive-311119", + "type_id": 3 } diff --git a/tests/api_tests/hivemind/tavern/bridge_api_patterns/get_ranked_posts/created/community_1111119.pat.json b/tests/api_tests/hivemind/tavern/bridge_api_patterns/get_ranked_posts/created/community_1111119.pat.json new file mode 100644 index 0000000000000000000000000000000000000000..fe51488c7066f6687ef680d6bfaa4f7768ef205c --- /dev/null +++ b/tests/api_tests/hivemind/tavern/bridge_api_patterns/get_ranked_posts/created/community_1111119.pat.json @@ -0,0 +1 @@ +[] diff --git a/tests/api_tests/hivemind/tavern/bridge_api_patterns/get_ranked_posts/created/community_1111119.tavern.yaml b/tests/api_tests/hivemind/tavern/bridge_api_patterns/get_ranked_posts/created/community_1111119.tavern.yaml new file mode 100644 index 0000000000000000000000000000000000000000..2f1c2de4adf581a205e3b5f9175fcf99bcd372df --- /dev/null +++ b/tests/api_tests/hivemind/tavern/bridge_api_patterns/get_ranked_posts/created/community_1111119.tavern.yaml @@ -0,0 +1,27 @@ +--- + test_name: Hivemind + + marks: + - patterntest + + includes: + - !include ../../../common.yaml + + stages: + - name: test + request: + url: "{service.proto:s}://{service.server:s}:{service.port}/" + method: POST + headers: + content-type: application/json + json: + jsonrpc: "2.0" + id: 1 + method: "bridge.get_ranked_posts" + params: {"sort":"created", "tag":"hive-111119"} + response: + status_code: 200 + verify_response_with: + function: validate_response:compare_response_with_pattern + extra_kwargs: + ignore_tags: "<bridge posts>"