diff --git a/docs/communities.md b/docs/communities.md index dde4fa74923392a7ad85fe8b6f837c975e060050..f148660ea2bc4a53b4253e26fc71d54f6255da8f 100644 --- a/docs/communities.md +++ b/docs/communities.md @@ -197,7 +197,7 @@ The standard format for `custom_json` ops: ["setRole", { "community": <community>, "account": <account>, - "role": admin|mod|member|none|muted + "role": admin|mod|member|none|muted, "notes": <comment> }] ``` @@ -444,4 +444,4 @@ modlog 1. Stratos subapp: Communities - https://github.com/stratos-steem/stratos/wiki/Subapp:-Communities \ No newline at end of file + https://github.com/stratos-steem/stratos/wiki/Subapp:-Communities diff --git a/hive/indexer/blocks.py b/hive/indexer/blocks.py index ad34dd6944b28b6e6eb81defca6dc1ae347ebd44..07d75c2cd8c5b830703517c16eb03ff3416f2264 100644 --- a/hive/indexer/blocks.py +++ b/hive/indexer/blocks.py @@ -84,6 +84,11 @@ class Blocks: elif op_type == 'create_claimed_account_operation': account_names.add(op['new_account_name']) + # account metadata updates + elif op_type == 'account_update_operation': + if not is_initial_sync: + Accounts.dirty(set([op['account']])) + # post ops elif op_type == 'comment_operation': comment_ops.append(op) diff --git a/hive/indexer/posts.py b/hive/indexer/posts.py index 43953db6e1d3a403b9c2309f48ae804b2bc3d277..188356221b0b1a6cf35bffe185bccb05378299fe 100644 --- a/hive/indexer/posts.py +++ b/hive/indexer/posts.py @@ -156,6 +156,11 @@ class Posts: CachedPost.delete(pid, op['author'], op['permlink']) if depth == 0: FeedCache.delete(pid) + else: + # force parent child recount when child is deleted + prnt = cls._get_parent_by_child_id(pid) + CachedPost.recount(prnt['author'], prnt['permlink'], prnt['id']) + @classmethod def update(cls, op, date, pid): @@ -168,6 +173,16 @@ class Posts: if not DbState.is_initial_sync(): CachedPost.update(op['author'], op['permlink'], pid) + @classmethod + def _get_parent_by_child_id(cls, child_id): + """Get parent's `id`, `author`, `permlink` by child id.""" + sql = """SELECT id, author, permlink FROM hive_posts + WHERE id = (SELECT parent_id FROM hive_posts + WHERE id = :child_id)""" + result = DB.query_row(sql, child_id=child_id) + assert result, "parent of %d not found" % child_id + return result + @classmethod def _insert_feed_cache(cls, post): """Insert the new post into feed cache if it's not a comment.""" diff --git a/hive/server/condenser_api/objects.py b/hive/server/condenser_api/objects.py index d8ee9a7ea3a8a04a557b13f3ec59fd5dfb9449b2..d0d6413091368dcb34ef3c47494e5ca5d759625b 100644 --- a/hive/server/condenser_api/objects.py +++ b/hive/server/condenser_api/objects.py @@ -120,6 +120,10 @@ def _condenser_post_object(row, truncate_body=0): """Given a hive_posts_cache row, create a legacy-style post object.""" paid = row['is_paidout'] + # condenser#3424 mitigation + if not row['category']: + row['category'] = 'undefined' + post = {} post['post_id'] = row['post_id'] post['author'] = row['author']