From 613acc7b0013ecd5d38d1dc5a40dd08d14ad8a34 Mon Sep 17 00:00:00 2001 From: Jack Robison Date: Fri, 30 Jul 2021 18:17:08 -0400 Subject: [PATCH] fix tests --- lbry/wallet/server/leveldb.py | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/lbry/wallet/server/leveldb.py b/lbry/wallet/server/leveldb.py index 1d03b2892..541edf2df 100644 --- a/lbry/wallet/server/leveldb.py +++ b/lbry/wallet/server/leveldb.py @@ -594,17 +594,34 @@ class LevelDB: ) return if reposted_metadata: - reposted_tags = [] if not reposted_metadata.is_stream else [tag for tag in reposted_metadata.stream.tags] - reposted_languages = [] if not reposted_metadata.is_stream else ( - [lang.language or 'none' for lang in reposted_metadata.stream.languages] or ['none'] - ) + if reposted_metadata.is_stream: + meta = reposted_metadata.stream + elif reposted_metadata.is_channel: + meta = reposted_metadata.channel + elif reposted_metadata.is_collection: + meta = reposted_metadata.collection + elif reposted_metadata.is_repost: + meta = reposted_metadata.repost + else: + return + reposted_tags = [tag for tag in meta.tags] + reposted_languages = [lang.language or 'none' for lang in meta.languages] or ['none'] + reposted_has_source = False if not reposted_metadata.is_stream else reposted_metadata.stream.has_source reposted_claim_type = CLAIM_TYPES[reposted_metadata.claim_type] - claim_tags = [] if not metadata.is_stream else [tag for tag in metadata.stream.tags] - claim_languages = [] if not metadata.is_stream else ( - [lang.language or 'none' for lang in metadata.stream.languages] or ['none'] - ) + if metadata.is_stream: + meta = metadata.stream + elif metadata.is_channel: + meta = metadata.channel + elif metadata.is_collection: + meta = metadata.collection + elif metadata.is_repost: + meta = metadata.repost + else: + return + claim_tags = [tag for tag in meta.tags] + claim_languages = [lang.language or 'none' for lang in meta.languages] or ['none'] tags = list(set(claim_tags).union(set(reposted_tags))) languages = list(set(claim_languages).union(set(reposted_languages)))