Skip to content
Snippets Groups Projects
Unverified Commit fc1806f8 authored by roadscape's avatar roadscape Committed by GitHub
Browse files

Merge pull request #217 from steemit/207-bugfix

bugfixes
parents cebbb920 edf8678f
No related branches found
No related tags found
No related merge requests found
...@@ -197,7 +197,7 @@ The standard format for `custom_json` ops: ...@@ -197,7 +197,7 @@ The standard format for `custom_json` ops:
["setRole", { ["setRole", {
"community": <community>, "community": <community>,
"account": <account>, "account": <account>,
"role": admin|mod|member|none|muted "role": admin|mod|member|none|muted,
"notes": <comment> "notes": <comment>
}] }]
``` ```
...@@ -444,4 +444,4 @@ modlog ...@@ -444,4 +444,4 @@ modlog
1. Stratos subapp: Communities 1. Stratos subapp: Communities
https://github.com/stratos-steem/stratos/wiki/Subapp:-Communities https://github.com/stratos-steem/stratos/wiki/Subapp:-Communities
\ No newline at end of file
...@@ -84,6 +84,11 @@ class Blocks: ...@@ -84,6 +84,11 @@ class Blocks:
elif op_type == 'create_claimed_account_operation': elif op_type == 'create_claimed_account_operation':
account_names.add(op['new_account_name']) 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 # post ops
elif op_type == 'comment_operation': elif op_type == 'comment_operation':
comment_ops.append(op) comment_ops.append(op)
......
...@@ -156,6 +156,11 @@ class Posts: ...@@ -156,6 +156,11 @@ class Posts:
CachedPost.delete(pid, op['author'], op['permlink']) CachedPost.delete(pid, op['author'], op['permlink'])
if depth == 0: if depth == 0:
FeedCache.delete(pid) 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 @classmethod
def update(cls, op, date, pid): def update(cls, op, date, pid):
...@@ -168,6 +173,16 @@ class Posts: ...@@ -168,6 +173,16 @@ class Posts:
if not DbState.is_initial_sync(): if not DbState.is_initial_sync():
CachedPost.update(op['author'], op['permlink'], pid) 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 @classmethod
def _insert_feed_cache(cls, post): def _insert_feed_cache(cls, post):
"""Insert the new post into feed cache if it's not a comment.""" """Insert the new post into feed cache if it's not a comment."""
......
...@@ -120,6 +120,10 @@ def _condenser_post_object(row, truncate_body=0): ...@@ -120,6 +120,10 @@ def _condenser_post_object(row, truncate_body=0):
"""Given a hive_posts_cache row, create a legacy-style post object.""" """Given a hive_posts_cache row, create a legacy-style post object."""
paid = row['is_paidout'] paid = row['is_paidout']
# condenser#3424 mitigation
if not row['category']:
row['category'] = 'undefined'
post = {} post = {}
post['post_id'] = row['post_id'] post['post_id'] = row['post_id']
post['author'] = row['author'] post['author'] = row['author']
......
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