Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
H
hivemind
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hive
hivemind
Commits
b8adfacb
Commit
b8adfacb
authored
4 years ago
by
Andrzej Lisak
Browse files
Options
Downloads
Patches
Plain Diff
[ABW]: [Ign] CLRF and other formatting
parent
801b320e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!456
Release candidate v1 24
,
!410
more small changes, get_discussions_by_blog reusing bridge SQL function
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
hive/db/sql_scripts/bridge_get_account_posts_by_blog.sql
+83
-83
83 additions, 83 deletions
hive/db/sql_scripts/bridge_get_account_posts_by_blog.sql
hive/server/hive_api/community.py
+1
-2
1 addition, 2 deletions
hive/server/hive_api/community.py
with
84 additions
and
85 deletions
hive/db/sql_scripts/bridge_get_account_posts_by_blog.sql
+
83
−
83
View file @
b8adfacb
DROP
FUNCTION
IF
EXISTS
bridge_get_account_posts_by_blog
;
DROP
FUNCTION
IF
EXISTS
bridge_get_account_posts_by_blog
;
CREATE
OR
REPLACE
FUNCTION
bridge_get_account_posts_by_blog
(
CREATE
OR
REPLACE
FUNCTION
bridge_get_account_posts_by_blog
(
in
_account
VARCHAR
,
in
_account
VARCHAR
,
in
_author
VARCHAR
,
in
_author
VARCHAR
,
in
_permlink
VARCHAR
,
in
_permlink
VARCHAR
,
in
_limit
INTEGER
,
in
_limit
INTEGER
,
in
_bridge_api
BOOLEAN
in
_bridge_api
BOOLEAN
)
)
RETURNS
SETOF
bridge_api_post
RETURNS
SETOF
bridge_api_post
AS
AS
$
function
$
$
function
$
DECLARE
DECLARE
__post_id
INTEGER
;
__post_id
INTEGER
;
__account_id
INTEGER
;
__account_id
INTEGER
;
__created_at
TIMESTAMP
;
__created_at
TIMESTAMP
;
BEGIN
BEGIN
__account_id
=
find_account_id
(
_account
,
True
);
__account_id
=
find_account_id
(
_account
,
True
);
__post_id
=
find_comment_id
(
_author
,
_permlink
,
True
);
__post_id
=
find_comment_id
(
_author
,
_permlink
,
True
);
IF
__post_id
<>
0
THEN
IF
__post_id
<>
0
THEN
SELECT
hfc
.
created_at
INTO
__created_at
SELECT
hfc
.
created_at
INTO
__created_at
FROM
hive_feed_cache
hfc
FROM
hive_feed_cache
hfc
WHERE
hfc
.
account_id
=
__account_id
AND
hfc
.
post_id
=
__post_id
;
WHERE
hfc
.
account_id
=
__account_id
AND
hfc
.
post_id
=
__post_id
;
END
IF
;
END
IF
;
RETURN
QUERY
SELECT
-- bridge_get_account_posts_by_blog
RETURN
QUERY
SELECT
-- bridge_get_account_posts_by_blog
hp
.
id
,
hp
.
id
,
hp
.
author
,
hp
.
author
,
hp
.
parent_author
,
hp
.
parent_author
,
hp
.
author_rep
,
hp
.
author_rep
,
hp
.
root_title
,
hp
.
root_title
,
hp
.
beneficiaries
,
hp
.
beneficiaries
,
hp
.
max_accepted_payout
,
hp
.
max_accepted_payout
,
hp
.
percent_hbd
,
hp
.
percent_hbd
,
hp
.
url
,
hp
.
url
,
hp
.
permlink
,
hp
.
permlink
,
hp
.
parent_permlink_or_category
,
hp
.
parent_permlink_or_category
,
hp
.
title
,
hp
.
title
,
hp
.
body
,
hp
.
body
,
hp
.
category
,
hp
.
category
,
hp
.
depth
,
hp
.
depth
,
hp
.
promoted
,
hp
.
promoted
,
hp
.
payout
,
hp
.
payout
,
hp
.
pending_payout
,
hp
.
pending_payout
,
hp
.
payout_at
,
hp
.
payout_at
,
hp
.
is_paidout
,
hp
.
is_paidout
,
hp
.
children
,
hp
.
children
,
hp
.
votes
,
hp
.
votes
,
hp
.
created_at
,
hp
.
created_at
,
hp
.
updated_at
,
hp
.
updated_at
,
hp
.
rshares
,
hp
.
rshares
,
hp
.
abs_rshares
,
hp
.
abs_rshares
,
hp
.
json
,
hp
.
json
,
hp
.
is_hidden
,
hp
.
is_hidden
,
hp
.
is_grayed
,
hp
.
is_grayed
,
hp
.
total_votes
,
hp
.
total_votes
,
hp
.
sc_trend
,
hp
.
sc_trend
,
hp
.
role_title
,
hp
.
role_title
,
hp
.
community_title
,
hp
.
community_title
,
hp
.
role_id
,
hp
.
role_id
,
hp
.
is_pinned
,
hp
.
is_pinned
,
hp
.
curator_payout_value
,
hp
.
curator_payout_value
,
hp
.
is_muted
hp
.
is_muted
FROM
hive_posts_view
hp
FROM
hive_posts_view
hp
JOIN
JOIN
(
(
SELECT
hfc
.
post_id
,
hfc
.
created_at
SELECT
hfc
.
post_id
,
hfc
.
created_at
FROM
hive_feed_cache
hfc
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
)
)
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
AND
(
NOT
_bridge_api
OR
NOT
EXISTS
(
SELECT
NULL
FROM
hive_posts
hp1
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
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
)
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
ORDER
BY
hfc
.
created_at
DESC
,
hfc
.
post_id
DESC
LIMIT
_limit
LIMIT
_limit
)
blog
ON
hp
.
id
=
blog
.
post_id
)
blog
ON
hp
.
id
=
blog
.
post_id
ORDER
BY
blog
.
created_at
DESC
,
blog
.
post_id
DESC
ORDER
BY
blog
.
created_at
DESC
,
blog
.
post_id
DESC
LIMIT
_limit
;
LIMIT
_limit
;
END
END
$
function
$
$
function
$
language
plpgsql
STABLE
;
language
plpgsql
STABLE
;
This diff is collapsed.
Click to expand it.
hive/server/hive_api/community.py
+
1
−
2
View file @
b8adfacb
...
@@ -311,8 +311,7 @@ async def _append_admins(db, communities):
...
@@ -311,8 +311,7 @@ async def _append_admins(db, communities):
ids
=
communities
.
keys
()
ids
=
communities
.
keys
()
sql
=
"""
SELECT community_id, ha.name FROM hive_roles hr
sql
=
"""
SELECT community_id, ha.name FROM hive_roles hr
JOIN hive_accounts ha ON hr.account_id = ha.id
JOIN hive_accounts ha ON hr.account_id = ha.id
WHERE role_id = 6 AND community_id IN :ids
WHERE role_id = 6 AND community_id IN :ids ORDER BY ha.name
"""
ORDER BY ha.name
"""
for
row
in
await
db
.
query_all
(
sql
,
ids
=
tuple
(
ids
)):
for
row
in
await
db
.
query_all
(
sql
,
ids
=
tuple
(
ids
)):
_id
=
row
[
0
]
_id
=
row
[
0
]
if
'
admins
'
not
in
communities
[
_id
]:
if
'
admins
'
not
in
communities
[
_id
]:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment