Skip to content
Snippets Groups Projects
Commit 77f5b817 authored by Bartek Wrona's avatar Bartek Wrona
Browse files

Merge branch 'bw_get_account_posts_by_blog_fix' into 'develop'

get account posts by blog fixes

See merge request !358
parents 09f66e6e fc52ea6c
No related branches found
No related tags found
2 merge requests!456Release candidate v1 24,!358get account posts by blog fixes
...@@ -17,16 +17,12 @@ BEGIN ...@@ -17,16 +17,12 @@ BEGIN
IF _permlink <> '' THEN IF _permlink <> '' THEN
__post_id = find_comment_id( _author, _permlink, True ); __post_id = find_comment_id( _author, _permlink, True );
__created_at = SELECT hfc.created_at INTO __created_at
( FROM hive_feed_cache hfc
SELECT created_at WHERE hfc.account_id = __account_id AND hfc.post_id = __post_id;
FROM hive_feed_cache
WHERE account_id = __account_id
AND post_id = __post_id
);
END IF; END IF;
RETURN QUERY SELECT RETURN QUERY SELECT -- bridge_get_account_posts_by_blog
hp.id, hp.id,
hp.author, hp.author,
hp.parent_author, hp.parent_author,
...@@ -66,25 +62,18 @@ BEGIN ...@@ -66,25 +62,18 @@ BEGIN
FROM hive_posts_view hp FROM hive_posts_view hp
JOIN JOIN
( (
SELECT hfc.post_id SELECT hfc.post_id, hfc.created_at
FROM hive_feed_cache hfc FROM hive_feed_cache hfc
LEFT JOIN WHERE hfc.account_id = __account_id AND (__post_id = 0 OR hfc.created_at <= __created_at)
( AND NOT EXISTS (SELECT NULL FROM hive_posts hp
SELECT WHERE hp.id = hfc.post_id AND hp.counter_deleted = 0 AND hp.depth = 0 AND hp.community_id IS NOT NULL
hp.id AND NOT EXISTS (SELECT NULL FROM hive_reblogs hr WHERE hr.blogger_id = __account_id)
FROM )
hive_posts_view hp ORDER BY created_at DESC
LEFT JOIN hive_reblogs hr ON hp.id = hr.post_id LIMIT _limit
WHERE
hp.author_id = __account_id
AND hp.depth = 0
AND hp.community_id IS NOT NULL
) T ON hfc.post_id = T.id
WHERE hfc.account_id = __account_id AND ( __post_id = 0 OR hfc.created_at <= __created_at )
ORDER BY hfc.created_at DESC
)T ON hp.id = T.post_id )T ON hp.id = T.post_id
LIMIT _limit; ORDER BY T.created_at DESC
;
END END
$function$ $function$
language plpgsql STABLE; language plpgsql STABLE;
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