Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • 127-eliminate-more-references-to-hive_posts_view
  • 221-vacuum-hivemind-tables
  • 267-rebased-onto-develop
  • 267-update-notification-cache-3
  • 676-as-tiny-assets
  • 72-postgres-warning-about-wrong-collation-in-recursive_deps-2
  • abw_ecv_op_experiment
  • abw_max_retries
  • abw_post_delete_fix
  • abw_rshares_experiment
  • add-git-to-requirements
  • add-vote-info
  • arc-get-content-deleted
  • as-tmp-to-remove
  • asuch-limit-follows
  • asuch-postgrest-fixing-problems
  • asuch-replace-python-with-sql-get-follow-count
  • asuch-tmp-wip-condenser-get-blog
  • autoexplain-python
  • bridge_api.get_ranked_posts_fixes
  • bw_1_27_5rc8_2master
  • bw_develop-haf-rebase
  • bw_docker_supplement
  • bw_entrypoint_signal_handler_fix
  • bw_haf_compat_sync
  • bw_hafah_datasource_test
  • bw_master2develop
  • bw_mi/hivemind_wit_sa_btracker_rebase
  • bw_rebased_develop-haf
  • bw_restore_log_memory_usage_call
  • bw_simplify_blacklisted_by_observer_view
  • bw_temp_hived_source_node_verification
  • bw_update_posts_rshares_speedup
  • bw_v1_27_5_0_0_rc0
  • change-python-limits
  • cherry-pick-5dd1da34
  • cherry-pick-98eaf112
  • complete-refactor
  • db-upgrade-assert
  • deployed_20200917
  • deployed_20200928
  • deployed_20200928_pure
  • deployed_20200928_reversible_ops
  • deployed_fixes_2_develop
  • develop
  • develop-haf-backup
  • dk-benchmarks-ci-improvements
  • dk-communities-unit-tests
  • dk-get-ids-for-accounts-hotfix
  • dk-issue-3-concurrent-block-query
  • dk-list-votes-pre24
  • dk-migration-script-tags-support
  • dk-num-block-hive-feed-cache
  • dk-readme-update
  • dk-reputation_api_support
  • dk-revert-black-lists
  • dk-sql-file-list
  • dk-sql-script-executor
  • dk-sql-scripts-from-schema
  • dk-xdist-and-time
  • dn-autovacuum
  • dn-default-autovacuum
  • dn-testing
  • dn_get_block_range
  • dn_parallel_safe
  • dn_prof
  • doc-fix
  • dockerfile-update-fix
  • emf-limit-follows
  • enum_block_operations-support
  • feature/beneficiaries_communities
  • feature/hive_votes_no_index
  • feature/mute-reason-test
  • feature/mute-reason_rebase
  • feature/new_communities_type_old
  • feature/new_community_types
  • feature/role-only-if-subscribed-test1
  • fix-duplicate-pinned-posts
  • fixing-tests-with-limits
  • follow-deltas
  • follow-redesign
  • follow-redesign-speedups
  • follow-redesign-tests
  • follow_api_tests
  • get-discussion-experiment
  • hivemind_testers
  • imwatsi-first-steps
  • jes2850-decentralized-lists
  • jsalyers-add-a-cascade
  • jsalyers-fix-muting-for-reblogs
  • jsalyers-fix-muting-on-bridge-get-discussion
  • jsalyers-muting-v2
  • jsalyers-test-mute-changes
  • kbotor/backup/building-hivemind-from-other-repos
  • kbotor/building-hivemind-from-other-repos
  • kbotor/ci-rewrite-for-parallel-replay
  • km_ah_api
  • km_get_content_2_0
  • km_get_content_fill_missing2deployed
  • km_history
  • 0.25.4
  • 1.25.0rc0
  • 1.25.2rc
  • 1.26.0
  • 1.26.1
  • 1.26.2
  • 1.26.3
  • 1.27.0.dev0
  • 1.27.10
  • 1.27.11rc1
  • 1.27.11rc2
  • 1.27.11rc3
  • 1.27.11rc4
  • 1.27.11rc5
  • 1.27.3.0.0
  • 1.27.3.0.0dev11
  • 1.27.3.0.0dev12
  • 1.27.3.0.0dev7
  • 1.27.5
  • 1.27.5.0.0rc7
  • 1.27.5rc8
  • 1.27.5rc9
  • 1.27.6rc3
  • 1.27.6rc5
  • 1.27.6rc6
  • 1.27.6rc7
  • 1.27.6rc8
  • 1.27.6rc9
  • 1.27.7rc10
  • 1.27.7rc11
  • 1.27.7rc12
  • 1.27.7rc13
  • 1.27.7rc14
  • 1.27.7rc15
  • 1.27.7rc16
  • 1.27.8
  • 1.27.9
  • Before-dk-issue-3
  • Full-sync
  • Full-sync-20200928
  • Full-sync-20201026
  • ScheduledBenchmarkTesting_18_Aug
  • env/staging-permissions
  • full_hive_sync_17_05_2021
  • git_versioning_support
  • hivemind_ci_support
  • tmp-logs
  • v1.24-RC
  • v1.24.0
  • v1.24.1
  • v1.24.1-RC
  • v1.24.2
  • v1.25.1
  • v1.25.2
  • v1.25.3
  • v1.25.4
  • v1.26.0
  • v1.27.4.0.0
  • v1.27.4.0.0dev1
  • v1.27.4.0.0dev2
160 results

Target

Select target project
  • hive/hivemind
1 result
Select Git revision
  • 127-eliminate-more-references-to-hive_posts_view
  • 221-vacuum-hivemind-tables
  • 267-rebased-onto-develop
  • 267-update-notification-cache-3
  • 676-as-tiny-assets
  • 72-postgres-warning-about-wrong-collation-in-recursive_deps-2
  • abw_ecv_op_experiment
  • abw_max_retries
  • abw_post_delete_fix
  • abw_rshares_experiment
  • add-git-to-requirements
  • add-vote-info
  • arc-get-content-deleted
  • as-tmp-to-remove
  • asuch-limit-follows
  • asuch-postgrest-fixing-problems
  • asuch-replace-python-with-sql-get-follow-count
  • asuch-tmp-wip-condenser-get-blog
  • autoexplain-python
  • bridge_api.get_ranked_posts_fixes
  • bw_1_27_5rc8_2master
  • bw_develop-haf-rebase
  • bw_docker_supplement
  • bw_entrypoint_signal_handler_fix
  • bw_haf_compat_sync
  • bw_hafah_datasource_test
  • bw_master2develop
  • bw_mi/hivemind_wit_sa_btracker_rebase
  • bw_rebased_develop-haf
  • bw_restore_log_memory_usage_call
  • bw_simplify_blacklisted_by_observer_view
  • bw_temp_hived_source_node_verification
  • bw_update_posts_rshares_speedup
  • bw_v1_27_5_0_0_rc0
  • change-python-limits
  • cherry-pick-5dd1da34
  • cherry-pick-98eaf112
  • complete-refactor
  • db-upgrade-assert
  • deployed_20200917
  • deployed_20200928
  • deployed_20200928_pure
  • deployed_20200928_reversible_ops
  • deployed_fixes_2_develop
  • develop
  • develop-haf-backup
  • dk-benchmarks-ci-improvements
  • dk-communities-unit-tests
  • dk-get-ids-for-accounts-hotfix
  • dk-issue-3-concurrent-block-query
  • dk-list-votes-pre24
  • dk-migration-script-tags-support
  • dk-num-block-hive-feed-cache
  • dk-readme-update
  • dk-reputation_api_support
  • dk-revert-black-lists
  • dk-sql-file-list
  • dk-sql-script-executor
  • dk-sql-scripts-from-schema
  • dk-xdist-and-time
  • dn-autovacuum
  • dn-default-autovacuum
  • dn-testing
  • dn_get_block_range
  • dn_parallel_safe
  • dn_prof
  • doc-fix
  • dockerfile-update-fix
  • emf-limit-follows
  • enum_block_operations-support
  • feature/beneficiaries_communities
  • feature/hive_votes_no_index
  • feature/mute-reason-test
  • feature/mute-reason_rebase
  • feature/new_communities_type_old
  • feature/new_community_types
  • feature/role-only-if-subscribed-test1
  • fix-duplicate-pinned-posts
  • fixing-tests-with-limits
  • follow-deltas
  • follow-redesign
  • follow-redesign-speedups
  • follow-redesign-tests
  • follow_api_tests
  • get-discussion-experiment
  • hivemind_testers
  • imwatsi-first-steps
  • jes2850-decentralized-lists
  • jsalyers-add-a-cascade
  • jsalyers-fix-muting-for-reblogs
  • jsalyers-fix-muting-on-bridge-get-discussion
  • jsalyers-muting-v2
  • jsalyers-test-mute-changes
  • kbotor/backup/building-hivemind-from-other-repos
  • kbotor/building-hivemind-from-other-repos
  • kbotor/ci-rewrite-for-parallel-replay
  • km_ah_api
  • km_get_content_2_0
  • km_get_content_fill_missing2deployed
  • km_history
  • 0.25.4
  • 1.25.0rc0
  • 1.25.2rc
  • 1.26.0
  • 1.26.1
  • 1.26.2
  • 1.26.3
  • 1.27.0.dev0
  • 1.27.10
  • 1.27.11rc1
  • 1.27.11rc2
  • 1.27.11rc3
  • 1.27.11rc4
  • 1.27.11rc5
  • 1.27.3.0.0
  • 1.27.3.0.0dev11
  • 1.27.3.0.0dev12
  • 1.27.3.0.0dev7
  • 1.27.5
  • 1.27.5.0.0rc7
  • 1.27.5rc8
  • 1.27.5rc9
  • 1.27.6rc3
  • 1.27.6rc5
  • 1.27.6rc6
  • 1.27.6rc7
  • 1.27.6rc8
  • 1.27.6rc9
  • 1.27.7rc10
  • 1.27.7rc11
  • 1.27.7rc12
  • 1.27.7rc13
  • 1.27.7rc14
  • 1.27.7rc15
  • 1.27.7rc16
  • 1.27.8
  • 1.27.9
  • Before-dk-issue-3
  • Full-sync
  • Full-sync-20200928
  • Full-sync-20201026
  • ScheduledBenchmarkTesting_18_Aug
  • env/staging-permissions
  • full_hive_sync_17_05_2021
  • git_versioning_support
  • hivemind_ci_support
  • tmp-logs
  • v1.24-RC
  • v1.24.0
  • v1.24.1
  • v1.24.1-RC
  • v1.24.2
  • v1.25.1
  • v1.25.2
  • v1.25.3
  • v1.25.4
  • v1.26.0
  • v1.27.4.0.0
  • v1.27.4.0.0dev1
  • v1.27.4.0.0dev2
160 results
Show changes
Commits on Source (11)
...@@ -601,7 +601,6 @@ def setup(db): ...@@ -601,7 +601,6 @@ def setup(db):
"database_api_list_votes.sql", "database_api_list_votes.sql",
"update_posts_rshares.sql", "update_posts_rshares.sql",
"update_hive_post_root_id.sql", "update_hive_post_root_id.sql",
"condenser_get_by_replies_to_account.sql",
"condenser_get_by_account_comments.sql", "condenser_get_by_account_comments.sql",
"condenser_get_by_blog_without_reblog.sql", "condenser_get_by_blog_without_reblog.sql",
"bridge_get_by_feed_with_reblog.sql", "bridge_get_by_feed_with_reblog.sql",
......
DROP FUNCTION IF EXISTS bridge_get_account_posts_by_replies; DROP FUNCTION IF EXISTS bridge_get_account_posts_by_replies;
CREATE FUNCTION bridge_get_account_posts_by_replies( in _account VARCHAR, in _author VARCHAR, in _permlink VARCHAR, in _limit SMALLINT ) CREATE FUNCTION bridge_get_account_posts_by_replies( in _account VARCHAR, in _author VARCHAR, in _permlink VARCHAR, in _limit SMALLINT, in _bridge_api BOOLEAN )
RETURNS SETOF bridge_api_post RETURNS SETOF bridge_api_post
AS AS
$function$ $function$
...@@ -8,8 +8,18 @@ DECLARE ...@@ -8,8 +8,18 @@ DECLARE
__account_id INT; __account_id INT;
__post_id INT; __post_id INT;
BEGIN BEGIN
__account_id = find_account_id( _account, True ); IF NOT _bridge_api AND _permlink <> '' THEN
__post_id = find_comment_id( _author, _permlink, True ); -- find blogger account using parent author of page defining post
__post_id = find_comment_id( _author, _permlink, True );
SELECT pp.author_id INTO __account_id
FROM hive_posts hp
JOIN hive_posts pp ON hp.parent_id = pp.id
WHERE hp.id = __post_id;
IF __account_id = 0 THEN __account_id = NULL; END IF;
ELSE
__account_id = find_account_id( _account, True );
__post_id = find_comment_id( _author, _permlink, True );
END IF;
RETURN QUERY SELECT RETURN QUERY SELECT
hp.id, hp.id,
hp.author, hp.author,
......
...@@ -27,7 +27,7 @@ BEGIN ...@@ -27,7 +27,7 @@ BEGIN
__account_id = find_account_id( _account, True ); __account_id = find_account_id( _account, True );
__start_id = find_account_id( _start, _start <> '' ); __start_id = find_account_id( _start, _start <> '' );
IF __start_id <> 0 THEN IF __start_id <> 0 THEN
SELECT INTO __start_id COALESCE( ( SELECT id FROM hive_follows WHERE following = __account_id AND follower = __start_id ), 0 ); SELECT INTO __start_id ( SELECT id FROM hive_follows WHERE following = __account_id AND follower = __start_id );
END IF; END IF;
RETURN QUERY SELECT RETURN QUERY SELECT
ha.name ha.name
...@@ -55,7 +55,7 @@ BEGIN ...@@ -55,7 +55,7 @@ BEGIN
__account_id = find_account_id( _account, True ); __account_id = find_account_id( _account, True );
__start_id = find_account_id( _start, _start <> '' ); __start_id = find_account_id( _start, _start <> '' );
IF __start_id <> 0 THEN IF __start_id <> 0 THEN
SELECT INTO __start_id COALESCE( ( SELECT id FROM hive_follows WHERE follower = __account_id AND following = __start_id ), 0 ); SELECT INTO __start_id ( SELECT id FROM hive_follows WHERE follower = __account_id AND following = __start_id );
END IF; END IF;
RETURN QUERY SELECT RETURN QUERY SELECT
ha.name ha.name
......
DROP FUNCTION IF EXISTS condenser_get_by_replies_to_account;
CREATE OR REPLACE FUNCTION condenser_get_by_replies_to_account(
in _author VARCHAR,
in _permlink VARCHAR,
in _limit INTEGER
)
RETURNS SETOF bridge_api_post
AS
$function$
DECLARE
__post_id INTEGER := 0;
BEGIN
IF _permlink <> '' THEN
SELECT
ha_pp.name, hp.id
INTO
_author, __post_id
FROM hive_posts hp
JOIN hive_posts pp ON hp.parent_id = pp.id
JOIN hive_accounts ha_pp ON ha_pp.id = pp.author_id
JOIN hive_permlink_data hpd_pp ON hpd_pp.id = pp.permlink_id
JOIN hive_accounts ha ON hp.author_id = ha.id
WHERE
hpd_pp.permlink = _permlink AND ha.name = _author;
END IF;
RETURN QUERY SELECT
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 hp.id
FROM hive_posts_view hp
WHERE hp.author = _author
ORDER BY hp.id DESC
LIMIT _limit
) T ON hp.parent_id = T.id
WHERE ( ( __post_id = 0 ) OR ( hp.id <= __post_id ) )
ORDER BY hp.id DESC
LIMIT _limit;
END
$function$
language plpgsql STABLE;
...@@ -52,7 +52,6 @@ for sql in postgres_handle_view_changes.sql \ ...@@ -52,7 +52,6 @@ for sql in postgres_handle_view_changes.sql \
database_api_list_votes.sql \ database_api_list_votes.sql \
update_posts_rshares.sql \ update_posts_rshares.sql \
update_hive_post_root_id.sql \ update_hive_post_root_id.sql \
condenser_get_by_replies_to_account.sql \
condenser_get_by_account_comments.sql \ condenser_get_by_account_comments.sql \
condenser_get_by_blog_without_reblog.sql \ condenser_get_by_blog_without_reblog.sql \
bridge_get_by_feed_with_reblog.sql \ bridge_get_by_feed_with_reblog.sql \
......
...@@ -289,7 +289,7 @@ async def get_account_posts(context, sort:str, account:str, start_author:str='', ...@@ -289,7 +289,7 @@ async def get_account_posts(context, sort:str, account:str, start_author:str='',
sql = "SELECT * FROM bridge_get_account_posts_by_comments( (:account)::VARCHAR, (:author)::VARCHAR, (:permlink)::VARCHAR, (:limit)::SMALLINT )" sql = "SELECT * FROM bridge_get_account_posts_by_comments( (:account)::VARCHAR, (:author)::VARCHAR, (:permlink)::VARCHAR, (:limit)::SMALLINT )"
elif sort == 'replies': elif sort == 'replies':
account_posts = False account_posts = False
sql = "SELECT * FROM bridge_get_account_posts_by_replies( (:account)::VARCHAR, (:author)::VARCHAR, (:permlink)::VARCHAR, (:limit)::SMALLINT )" sql = "SELECT * FROM bridge_get_account_posts_by_replies( (:account)::VARCHAR, (:author)::VARCHAR, (:permlink)::VARCHAR, (:limit)::SMALLINT, True )"
elif sort == 'payout': elif sort == 'payout':
sql = "SELECT * FROM bridge_get_account_posts_by_payout( (:account)::VARCHAR, (:author)::VARCHAR, (:permlink)::VARCHAR, (:limit)::SMALLINT )" sql = "SELECT * FROM bridge_get_account_posts_by_payout( (:account)::VARCHAR, (:author)::VARCHAR, (:permlink)::VARCHAR, (:limit)::SMALLINT )"
......
...@@ -21,18 +21,16 @@ async def get_following(db, account: str, start: str, state: int, limit: int): ...@@ -21,18 +21,16 @@ async def get_following(db, account: str, start: str, state: int, limit: int):
async def get_reblogged_by(db, author: str, permlink: str): async def get_reblogged_by(db, author: str, permlink: str):
"""Return all rebloggers of a post.""" """Return all rebloggers of a post."""
sql = "SELECT * FROM condenser_get_names_by_reblogged( '{}', '{}' )".format( author, permlink ) sql = "SELECT * FROM condenser_get_names_by_reblogged( (:author)::VARCHAR, (:permlink)::VARCHAR )"
names = await db.query_col(sql) names = await db.query_col(sql, author=author, permlink=permlink)
if author in names: if author in names:
names.remove(author) names.remove(author)
return names return names
async def get_data(db, sql:str, truncate_body: int = 0): async def process_posts(db, sql_result, truncate_body: int = 0):
result = await db.query_all(sql);
posts = [] posts = []
for row in result: for row in sql_result:
row = dict(row) row = dict(row)
post = _condenser_post_object(row, truncate_body=truncate_body) post = _condenser_post_object(row, truncate_body=truncate_body)
...@@ -43,20 +41,24 @@ async def get_data(db, sql:str, truncate_body: int = 0): ...@@ -43,20 +41,24 @@ async def get_data(db, sql:str, truncate_body: int = 0):
async def get_by_blog_without_reblog(db, account: str, start_permlink: str = '', limit: int = 20, truncate_body: int = 0): async def get_by_blog_without_reblog(db, account: str, start_permlink: str = '', limit: int = 20, truncate_body: int = 0):
"""Get a list of posts for an author's blog without reblogs.""" """Get a list of posts for an author's blog without reblogs."""
sql = " SELECT * FROM condenser_get_by_blog_without_reblog( '{}', '{}', {} ) ".format( account, start_permlink, limit ) sql = "SELECT * FROM condenser_get_by_blog_without_reblog( (:author)::VARCHAR, (:permlink)::VARCHAR, :limit )"
return await get_data(db, sql, truncate_body ) result = await db.query_all(sql, author=account, permlink=start_permlink, limit=limit);
return await process_posts(db, result, truncate_body)
async def get_by_account_comments(db, account: str, start_permlink: str = '', limit: int = 20, truncate_body: int = 0): async def get_by_account_comments(db, account: str, start_permlink: str = '', limit: int = 20, truncate_body: int = 0):
"""Get a list of posts representing comments by an author.""" """Get a list of posts representing comments by an author."""
sql = " SELECT * FROM condenser_get_by_account_comments( '{}', '{}', {} ) ".format( account, start_permlink, limit ) sql = "SELECT * FROM condenser_get_by_account_comments( (:author)::VARCHAR, (:permlink)::VARCHAR, :limit )"
return await get_data(db, sql, truncate_body ) result = await db.query_all(sql, author=account, permlink=start_permlink, limit=limit);
return await process_posts(db, result, truncate_body)
async def get_by_replies_to_account(db, start_author: str, start_permlink: str = '', limit: int = 20, truncate_body: int = 0): async def get_by_replies_to_account(db, start_author: str, start_permlink: str = '', limit: int = 20, truncate_body: int = 0):
"""Get a list of posts representing replies to an author.""" """Get a list of posts representing replies to an author."""
sql = " SELECT * FROM condenser_get_by_replies_to_account( '{}', '{}', {} ) ".format( start_author, start_permlink, limit ) sql = "SELECT * FROM bridge_get_account_posts_by_replies( (:account)::VARCHAR, (:author)::VARCHAR, (:permlink)::VARCHAR, (:limit)::SMALLINT, False )"
return await get_data(db, sql, truncate_body ) result = await db.query_all(sql, account=start_author, author=start_author if start_permlink else '', permlink=start_permlink, limit=limit);
return await process_posts(db, result, truncate_body)
async def get_by_blog(db, account: str = '', start_author: str = '', start_permlink: str = '', limit: int = 20): async def get_by_blog(db, account: str = '', start_author: str = '', start_permlink: str = '', limit: int = 20):
"""Get a list of posts for an author's blog.""" """Get a list of posts for an author's blog."""
sql = " SELECT * FROM condenser_get_by_blog( '{}', '{}', '{}', {} ) ".format( account, start_author, start_permlink, limit ) sql = "SELECT * FROM condenser_get_by_blog( (:account)::VARCHAR, (:author)::VARCHAR, (:permlink)::VARCHAR, :limit )"
return await get_data(db, sql ) result = await db.query_all(sql, account=account, author=start_author, permlink=start_permlink, limit=limit);
return await process_posts(db, result)
...@@ -379,8 +379,12 @@ async def get_discussions_by_comments(context, start_author: str = None, start_p ...@@ -379,8 +379,12 @@ async def get_discussions_by_comments(context, start_author: str = None, start_p
async def get_replies_by_last_update(context, start_author: str = None, start_permlink: str = '', async def get_replies_by_last_update(context, start_author: str = None, start_permlink: str = '',
limit: int = 20, truncate_body: int = 0): limit: int = 20, truncate_body: int = 0):
"""Get all replies made to any of author's posts.""" """Get all replies made to any of author's posts."""
assert start_author, '`start_author` cannot be blank' # despite the name time of last edit is not used, posts ranked by creation time (that is, their id)
# note that in this call start_author has dual meaning:
# - when there is only start_author it means account that authored posts that we seek replies to
# - when there is also start_permlink it points to one of replies (last post of previous page) and
# we'll be getting account like above in form of author of parent post to the post pointed by
# given start_author+start_permlink
return await cursor.get_by_replies_to_account( return await cursor.get_by_replies_to_account(
context['db'], context['db'],
valid_account(start_author), valid_account(start_author),
......
Subproject commit cbb2c1c95d56181310e25d2ddcb9baff1bdaa83f Subproject commit c50665c8f66121db558caa7c205631c28e0fe2ed