Skip to content
Snippets Groups Projects
Commit 5467b448 authored by Dariusz Kędzierski's avatar Dariusz Kędzierski Committed by Jason Salyers
Browse files

Follower and following entries must be strings. Same behaviour as in old hivemind

parent b1f4457a
No related branches found
No related tags found
2 merge requests!456Release candidate v1 24,!370Jsalyers muting at sql level
This commit is part of merge request !370. Comments created here will be created in the context of that merge request.
......@@ -104,18 +104,15 @@ class Follow(DbAdapterHolder):
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 = []
# we expecting follower and following entries to be strings
# in older hivemind this check was done in Accounts.exists
# now following can be list of names so we need to check if all entries are strings
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
if not isinstance(following, str):
return None
if isinstance(op['follower'], list) or isinstance(op['follower'], dict):
op['follower'] = dumps(op['follower'])
else:
op['follower'] = str(op['follower'])
if not isinstance(op['follower'], str):
return None
# follower/following is empty
if not op['follower'] or not op['following']:
......
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