From e1194839c7fd4c62128c2b7b263b577b17d14c59 Mon Sep 17 00:00:00 2001 From: Dariusz Kedzierski <dkedzierski@syncad.com> Date: Sun, 8 Nov 2020 14:58:02 +0100 Subject: [PATCH] Mimic old hivemind behaviour for follower, following check. Use get_follow_count for testing --- hive/indexer/follow.py | 9 --- .../follow_op/mock_block_data_follow.json | 77 ------------------- 2 files changed, 86 deletions(-) diff --git a/hive/indexer/follow.py b/hive/indexer/follow.py index f01028b1a..79b0ee876 100644 --- a/hive/indexer/follow.py +++ b/hive/indexer/follow.py @@ -87,15 +87,6 @@ class Follow(DbAdapterHolder): return None op['following'] = op['following'] if isinstance(op['following'], list) else [op['following']] - - # additional layer of protection against putting complex data types as user names - as_str = [] - for following in op['following']: - if isinstance(following, list) or isinstance(following, dict): - as_str.append(dumps(following)) - else: - as_str.append(str(following)) - op['following'] = as_str # mimic original behaviour # if following name does not exist do not process it: basically equal to drop op for single following entry diff --git a/mock_data/block_data/follow_op/mock_block_data_follow.json b/mock_data/block_data/follow_op/mock_block_data_follow.json index 45dd18a6f..f33ebfaa1 100644 --- a/mock_data/block_data/follow_op/mock_block_data_follow.json +++ b/mock_data/block_data/follow_op/mock_block_data_follow.json @@ -442,83 +442,6 @@ "id": "follow", "json": "[\"follow\",{\"follower\":\"tester1\",\"following\":[\"tester3\", {\"gtg\":\"gtg\"}],\"what\":[\"blog\"]}]" } - }, - { - "type": "custom_json_operation", - "value": { - "required_auths": [], - "required_posting_auths": [ - "tester1" - ], - "id": "follow", - "json": "[\"follow\",{\"follower\":\"tester1\",\"following\":[\"tester7\", \"<script>alert('hello world');</script>\"],\"what\":[\"blog\"]}]" - } - }, - { - "type": "custom_json_operation", - "value": { - "required_auths": [], - "required_posting_auths": [ - "{\"tester1\":\"tester1\"}" - ], - "id": "follow", - "json": "[\"follow\",{\"follower\":{\"tester1\":\"tester1\"},\"following\":{\"tester3\":\"tester4\"},\"what\":[\"blog\"]}]" - } - }, - { - "type": "custom_json_operation", - "value": { - "required_auths": [], - "required_posting_auths": [ - "tester1" - ], - "id": "follow", - "json": "[\"follow\",{\"follower\":\"tester1\",\"following\":{\"tester3\":\"tester4\"},\"what\":[\"blog\"]}]" - } - }, - { - "type": "custom_json_operation", - "value": { - "required_auths": [], - "required_posting_auths": [ - "tester1" - ], - "id": "follow", - "json": "[\"follow\",{\"follower\":\"tester1\",\"following\":[\"tester3\", [\"tester4\"]],\"what\":[\"blog\"]}]" - } - }, - { - "type": "custom_json_operation", - "value": { - "required_auths": [], - "required_posting_auths": [ - "tester1" - ], - "id": "follow", - "json": "[\"follow\",{\"follower\":[\"tester1\"],\"following\":[\"tester3\", [\"tester4\"]],\"what\":[\"blog\"]}]" - } - }, - { - "type": "custom_json_operation", - "value": { - "required_auths": [], - "required_posting_auths": [ - "[\"tester1\"]" - ], - "id": "follow", - "json": "[\"follow\",{\"follower\":[\"tester1\"],\"following\":[\"tester3\", {\"tester4\":\"tester5\"}],\"what\":[\"blog\"]}]" - } - }, - { - "type": "custom_json_operation", - "value": { - "required_auths": [], - "required_posting_auths": [ - "tester1" - ], - "id": "follow", - "json": "[\"follow\",{\"follower\":\"tester1\",\"following\":[\"tester3\", {\"tester4\":\"tester5\"}],\"what\":[\"blog\"]}]" - } } ] } -- GitLab