From b8adfacb4ae9ddd8fb0421c498eaf691897303d9 Mon Sep 17 00:00:00 2001
From: ABW <andrzejl@syncad.com>
Date: Wed, 25 Nov 2020 17:27:17 +0100
Subject: [PATCH] [ABW]: [Ign] CLRF and other formatting

---
 .../bridge_get_account_posts_by_blog.sql      | 166 +++++++++---------
 hive/server/hive_api/community.py             |   3 +-
 2 files changed, 84 insertions(+), 85 deletions(-)

diff --git a/hive/db/sql_scripts/bridge_get_account_posts_by_blog.sql b/hive/db/sql_scripts/bridge_get_account_posts_by_blog.sql
index e831032ca..f605a5bc8 100644
--- a/hive/db/sql_scripts/bridge_get_account_posts_by_blog.sql
+++ b/hive/db/sql_scripts/bridge_get_account_posts_by_blog.sql
@@ -1,83 +1,83 @@
-DROP FUNCTION IF EXISTS bridge_get_account_posts_by_blog;
-
-CREATE OR REPLACE FUNCTION bridge_get_account_posts_by_blog(
-  in _account VARCHAR,
-  in _author VARCHAR,
-  in _permlink VARCHAR,
-  in _limit INTEGER,
-  in _bridge_api BOOLEAN
-)
-RETURNS SETOF bridge_api_post
-AS
-$function$
-DECLARE
-  __post_id INTEGER;
-  __account_id INTEGER;
-  __created_at TIMESTAMP;
-BEGIN
-  __account_id = find_account_id( _account, True );
-  __post_id = find_comment_id( _author, _permlink, True );
-  IF __post_id <> 0 THEN
-    SELECT hfc.created_at INTO __created_at
-    FROM hive_feed_cache hfc
-    WHERE hfc.account_id = __account_id AND hfc.post_id = __post_id;
-  END IF;
-
-  RETURN QUERY SELECT -- bridge_get_account_posts_by_blog
-      hp.id,
-      hp.author,
-      hp.parent_author,
-      hp.author_rep,
-      hp.root_title,
-      hp.beneficiaries,
-      hp.max_accepted_payout,
-      hp.percent_hbd,
-      hp.url,
-      hp.permlink,
-      hp.parent_permlink_or_category,
-      hp.title,
-      hp.body,
-      hp.category,
-      hp.depth,
-      hp.promoted,
-      hp.payout,
-      hp.pending_payout,
-      hp.payout_at,
-      hp.is_paidout,
-      hp.children,
-      hp.votes,
-      hp.created_at,
-      hp.updated_at,
-      hp.rshares,
-      hp.abs_rshares,
-      hp.json,
-      hp.is_hidden,
-      hp.is_grayed,
-      hp.total_votes,
-      hp.sc_trend,
-      hp.role_title,
-      hp.community_title,
-      hp.role_id,
-      hp.is_pinned,
-      hp.curator_payout_value,
-      hp.is_muted
-    FROM hive_posts_view hp
-    JOIN
-    (
-      SELECT hfc.post_id, hfc.created_at
-      FROM hive_feed_cache hfc
-      WHERE hfc.account_id = __account_id AND ( __post_id = 0 OR hfc.created_at < __created_at OR ( hfc.created_at = __created_at AND hfc.post_id < __post_id ) )
-        AND ( NOT _bridge_api OR
-              NOT EXISTS (SELECT NULL FROM hive_posts hp1
-                          WHERE hp1.id = hfc.post_id AND hp1.counter_deleted = 0 AND hp1.depth = 0 AND hp1.community_id IS NOT NULL
-                          AND NOT EXISTS (SELECT NULL FROM hive_reblogs hr WHERE hr.blogger_id = __account_id AND hr.post_id = hp1.id)
-                         )
-            )
-      ORDER BY hfc.created_at DESC, hfc.post_id DESC
-      LIMIT _limit
-    ) blog ON hp.id = blog.post_id
-    ORDER BY blog.created_at DESC, blog.post_id DESC
-    LIMIT _limit;
-END
-$function$
-language plpgsql STABLE;
+DROP FUNCTION IF EXISTS bridge_get_account_posts_by_blog;
+
+CREATE OR REPLACE FUNCTION bridge_get_account_posts_by_blog(
+  in _account VARCHAR,
+  in _author VARCHAR,
+  in _permlink VARCHAR,
+  in _limit INTEGER,
+  in _bridge_api BOOLEAN
+)
+RETURNS SETOF bridge_api_post
+AS
+$function$
+DECLARE
+  __post_id INTEGER;
+  __account_id INTEGER;
+  __created_at TIMESTAMP;
+BEGIN
+  __account_id = find_account_id( _account, True );
+  __post_id = find_comment_id( _author, _permlink, True );
+  IF __post_id <> 0 THEN
+    SELECT hfc.created_at INTO __created_at
+    FROM hive_feed_cache hfc
+    WHERE hfc.account_id = __account_id AND hfc.post_id = __post_id;
+  END IF;
+
+  RETURN QUERY SELECT -- bridge_get_account_posts_by_blog
+      hp.id,
+      hp.author,
+      hp.parent_author,
+      hp.author_rep,
+      hp.root_title,
+      hp.beneficiaries,
+      hp.max_accepted_payout,
+      hp.percent_hbd,
+      hp.url,
+      hp.permlink,
+      hp.parent_permlink_or_category,
+      hp.title,
+      hp.body,
+      hp.category,
+      hp.depth,
+      hp.promoted,
+      hp.payout,
+      hp.pending_payout,
+      hp.payout_at,
+      hp.is_paidout,
+      hp.children,
+      hp.votes,
+      hp.created_at,
+      hp.updated_at,
+      hp.rshares,
+      hp.abs_rshares,
+      hp.json,
+      hp.is_hidden,
+      hp.is_grayed,
+      hp.total_votes,
+      hp.sc_trend,
+      hp.role_title,
+      hp.community_title,
+      hp.role_id,
+      hp.is_pinned,
+      hp.curator_payout_value,
+      hp.is_muted
+    FROM hive_posts_view hp
+    JOIN
+    (
+      SELECT hfc.post_id, hfc.created_at
+      FROM hive_feed_cache hfc
+      WHERE hfc.account_id = __account_id AND ( __post_id = 0 OR hfc.created_at < __created_at OR ( hfc.created_at = __created_at AND hfc.post_id < __post_id ) )
+        AND ( NOT _bridge_api OR
+              NOT EXISTS (SELECT NULL FROM hive_posts hp1
+                          WHERE hp1.id = hfc.post_id AND hp1.counter_deleted = 0 AND hp1.depth = 0 AND hp1.community_id IS NOT NULL
+                          AND NOT EXISTS (SELECT NULL FROM hive_reblogs hr WHERE hr.blogger_id = __account_id AND hr.post_id = hp1.id)
+                         )
+            )
+      ORDER BY hfc.created_at DESC, hfc.post_id DESC
+      LIMIT _limit
+    ) blog ON hp.id = blog.post_id
+    ORDER BY blog.created_at DESC, blog.post_id DESC
+    LIMIT _limit;
+END
+$function$
+language plpgsql STABLE;
diff --git a/hive/server/hive_api/community.py b/hive/server/hive_api/community.py
index e3dc0f8e5..95ae7f07c 100644
--- a/hive/server/hive_api/community.py
+++ b/hive/server/hive_api/community.py
@@ -311,8 +311,7 @@ async def _append_admins(db, communities):
     ids = communities.keys()
     sql = """SELECT community_id, ha.name FROM hive_roles hr
                JOIN hive_accounts ha ON hr.account_id = ha.id
-              WHERE role_id = 6 AND community_id IN :ids
-              ORDER BY ha.name"""
+              WHERE role_id = 6 AND community_id IN :ids ORDER BY ha.name"""
     for row in await db.query_all(sql, ids=tuple(ids)):
         _id = row[0]
         if 'admins' not in communities[_id]:
-- 
GitLab