Skip to content
Snippets Groups Projects
Commit 6ac92bef authored by Martin Lees's avatar Martin Lees Committed by Howo
Browse files

Fixed sql queries, and added tests

parent d42406f8
No related branches found
No related tags found
1 merge request!531Community type 2 and 3 + update community type op
...@@ -48,21 +48,23 @@ BEGIN ...@@ -48,21 +48,23 @@ BEGIN
ELSE ELSE
IF _community_id IS NOT NULL THEN IF _community_id IS NOT NULL THEN
SELECT type_id INTO __community_type_id FROM hivemind_app.hive_communities WHERE id = _community_id; SELECT type_id INTO __community_type_id FROM hivemind_app.hive_communities WHERE id = _community_id;
__community_id = _community_id;
ELSE ELSE
SELECT type_id, id INTO __community_type_id, _community_id from hivemind_app.hive_communities where name = _community_name; 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; END IF;
IF __community_type_id = __community_type_topic THEN IF __community_type_id = __community_type_topic THEN
__is_muted := TRUE; __is_muted := FALSE;
ELSE ELSE
IF __community_type_id = __community_type_journal AND is_comment = TRUE THEN IF __community_type_id = __community_type_journal AND is_comment = TRUE THEN
__is_muted := TRUE; __is_muted := FALSE;
ELSE 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; 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 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 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; END IF;
END IF; END IF;
...@@ -122,7 +124,7 @@ if _parent_author != '' THEN ...@@ -122,7 +124,7 @@ if _parent_author != '' THEN
_block_num as block_num, _block_num as block_num_created _block_num as block_num, _block_num as block_num_created
FROM hivemind_app.hive_accounts ha, FROM hivemind_app.hive_accounts ha,
hivemind_app.hive_permlink_data hpd, 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 hivemind_app.hive_posts php
INNER JOIN hivemind_app.hive_accounts pha ON pha.id = php.author_id 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 INNER JOIN hivemind_app.hive_permlink_data phpd ON phpd.id = php.permlink_id
......
...@@ -5,14 +5,14 @@ ...@@ -5,14 +5,14 @@
"created_at": "2016-09-15 19:47:51", "created_at": "2016-09-15 19:47:51",
"description": "", "description": "",
"flag_text": "", "flag_text": "",
"id": 92531, "id": 92532,
"is_nsfw": false, "is_nsfw": false,
"lang": "en", "lang": "en",
"name": "hive-211119", "name": "hive-211119",
"num_authors": 0, "num_authors": 0,
"num_pending": 0, "num_pending": 0,
"settings": {}, "settings": {},
"subscribers": 0, "subscribers": 1,
"sum_pending": 0, "sum_pending": 0,
"team": [ "team": [
[ [
...@@ -23,4 +23,4 @@ ...@@ -23,4 +23,4 @@
], ],
"title": "@hive-211119", "title": "@hive-211119",
"type_id": 2 "type_id": 2
} }
\ No newline at end of file
{ {
"about": "", "about": "",
"avatar_url": "", "avatar_url": "",
"context": {}, "context": {},
"created_at": "2016-09-15 19:47:51", "created_at": "2016-09-15 19:47:51",
"description": "", "description": "",
"flag_text": "", "flag_text": "",
"id": 92532, "id": 92533,
"is_nsfw": false, "is_nsfw": false,
"lang": "en", "lang": "en",
"name": "hive-311119", "name": "hive-311119",
"num_authors": 0, "num_authors": 0,
"num_pending": 0, "num_pending": 0,
"settings": {}, "settings": {},
"subscribers": 0, "subscribers": 1,
"sum_pending": 0, "sum_pending": 0,
"team": [ "team": [
[ [
"hive-311119", "hive-311119",
"owner", "owner",
"" ""
] ]
], ],
"title": "@hive-311119", "title": "@hive-311119",
"type_id": 3 "type_id": 3
} }
---
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>"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment