diff --git a/hive/indexer/community.py b/hive/indexer/community.py index 306959c365e70de726ee2c23e6e6e3abb04bae4d..98b5eb0154a3432b121099bec1c6d70a7cebbe1d 100644 --- a/hive/indexer/community.py +++ b/hive/indexer/community.py @@ -144,9 +144,8 @@ def is_community_post_valid(community, comment: dict) -> str: community_props = get_community(community) if not community_props: - # TODO: if a community is not found, assume it's completely open? - # all we need to do at that point is validate that its a valid acct name. - return False + # if this is not a defined community, it's free to post in. + return True if is_author_muted(author, community): return False diff --git a/hive/indexer/core.py b/hive/indexer/core.py index 05483bc156055b5e4bdf63eec206825f233be22c..317b9f5ec1b988d9885b04d15a0c50bc743d200b 100755 --- a/hive/indexer/core.py +++ b/hive/indexer/core.py @@ -115,8 +115,16 @@ def register_posts(ops, date): parent_id, parent_depth, category, community = parent_data depth = parent_depth + 1 + # community must be an existing account + if not get_account_id(community): + print("Invalid community @{}/{} -- {}".format(op['author'], op['permlink'], community)) + community = op['author'] + + # validated community; will return None if invalid & defaults to author. is_valid = int(is_community_post_valid(community, op)) + if not is_valid: + print("Invalid post @{}/{} in @{}".format(op['author'], op['permlink'], community)) # if we're reusing a previously-deleted post (rare!), update it if id: