From ebcda2ccfc94c64f5528e864038272ad81d670e0 Mon Sep 17 00:00:00 2001 From: Martin Lees <drov0@users.noreply.github.com> Date: Tue, 22 Mar 2022 21:16:39 -0400 Subject: [PATCH] code style --- hive/db/sql_scripts/hive_post_operations.sql | 25 ++++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/hive/db/sql_scripts/hive_post_operations.sql b/hive/db/sql_scripts/hive_post_operations.sql index a8dea392e..e6fb967fe 100644 --- a/hive/db/sql_scripts/hive_post_operations.sql +++ b/hive/db/sql_scripts/hive_post_operations.sql @@ -32,24 +32,24 @@ LANGUAGE plpgsql as $$ declare - _community_type_id SMALLINT; - _role_id SMALLINT; - _member_role CONSTANT SMALLINT := 2; - _community_type_topic CONSTANT SMALLINT := 1; - _community_type_journal CONSTANT SMALLINT := 2; - _community_type_council CONSTANT SMALLINT := 3; + __community_type_id SMALLINT; + __role_id SMALLINT; + __member_role CONSTANT SMALLINT := 2; + __community_type_topic CONSTANT SMALLINT := 1; + __community_type_journal CONSTANT SMALLINT := 2; + __community_type_council CONSTANT SMALLINT := 3; BEGIN - SELECT type_id INTO _community_type_id FROM hive_communities WHERE id = _community_id; - IF _community_type_id = _community_type_topic THEN + SELECT type_id INTO __community_type_id FROM hive_communities WHERE id = _community_id; + IF __community_type_id = __community_type_topic THEN return true; -- Community type 1 allows everyone to post & comment 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 RETURN TRUE; -- Community type journal allows everyone to comment END IF; - select role_id into _role_id from hive_roles where 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 + select role_id into __role_id from hive_roles where 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 RETURN TRUE; -- You have to be at least a member to post - 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 RETURN TRUE; -- You have to be at least a member to post or comment END IF; END IF; @@ -74,7 +74,6 @@ RETURNS TABLE (is_new_post boolean, id hive_posts.id%TYPE, author_id hive_posts. LANGUAGE plpgsql AS $function$ -#variable_conflict use_variable BEGIN INSERT INTO hive_permlink_data -- GitLab