forked from LBRYCommunity/lbry-sdk
claim search fixes for filtering with valid_channel_signatures
This commit is contained in:
parent
bae2939943
commit
f96c46e84a
3 changed files with 11 additions and 6 deletions
|
@ -1809,7 +1809,7 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||||
"""
|
"""
|
||||||
if kwargs.pop('valid_channel_signatures', False):
|
if kwargs.pop('valid_channel_signatures', False):
|
||||||
kwargs['is_channel_signature_valid'] = 1
|
kwargs['is_channel_signature_valid'] = 1
|
||||||
elif kwargs.pop('invalid_channel_signatures', False):
|
if kwargs.pop('invalid_channel_signatures', False):
|
||||||
kwargs['is_channel_signature_valid'] = 0
|
kwargs['is_channel_signature_valid'] = 0
|
||||||
page_num, page_size = abs(kwargs.pop('page', 1)), min(abs(kwargs.pop('page_size', 10)), 50)
|
page_num, page_size = abs(kwargs.pop('page', 1)), min(abs(kwargs.pop('page_size', 10)), 50)
|
||||||
kwargs.update({'offset': page_size * (page_num-1), 'limit': page_size})
|
kwargs.update({'offset': page_size * (page_num-1), 'limit': page_size})
|
||||||
|
|
|
@ -752,11 +752,15 @@ class SQLDB:
|
||||||
if 'claim_type' in constraints:
|
if 'claim_type' in constraints:
|
||||||
constraints['claim.claim_type'] = CLAIM_TYPES[constraints.pop('claim_type')]
|
constraints['claim.claim_type'] = CLAIM_TYPES[constraints.pop('claim_type')]
|
||||||
if 'stream_types' in constraints:
|
if 'stream_types' in constraints:
|
||||||
constraints['claim.stream_type__in'] = [
|
stream_types = constraints.pop('stream_types')
|
||||||
STREAM_TYPES[stream_type] for stream_type in constraints.pop('stream_types')
|
if stream_types:
|
||||||
]
|
constraints['claim.stream_type__in'] = [
|
||||||
|
STREAM_TYPES[stream_type] for stream_type in stream_types
|
||||||
|
]
|
||||||
if 'media_types' in constraints:
|
if 'media_types' in constraints:
|
||||||
constraints['claim.media_type__in'] = constraints.pop('media_types')
|
media_types = constraints.pop('media_types')
|
||||||
|
if media_types:
|
||||||
|
constraints['claim.media_type__in'] = media_types
|
||||||
|
|
||||||
_apply_constraints_for_array_attributes(constraints, 'tag')
|
_apply_constraints_for_array_attributes(constraints, 'tag')
|
||||||
_apply_constraints_for_array_attributes(constraints, 'language')
|
_apply_constraints_for_array_attributes(constraints, 'language')
|
||||||
|
|
|
@ -141,8 +141,9 @@ class ClaimSearchCommand(ClaimTestCase):
|
||||||
await self.channel_abandon(claim_id=self.channel_id)
|
await self.channel_abandon(claim_id=self.channel_id)
|
||||||
await self.assertFindsClaims([], channel_ids=[self.channel_id], valid_channel_signatures=True)
|
await self.assertFindsClaims([], channel_ids=[self.channel_id], valid_channel_signatures=True)
|
||||||
await self.assertFindsClaims([signed2], channel_ids=[channel_id2], valid_channel_signatures=True)
|
await self.assertFindsClaims([signed2], channel_ids=[channel_id2], valid_channel_signatures=True)
|
||||||
|
# pass `invalid_channel_signatures=False` to catch a bug in argument processing
|
||||||
await self.assertFindsClaims([signed2], channel_ids=[channel_id2, self.channel_id],
|
await self.assertFindsClaims([signed2], channel_ids=[channel_id2, self.channel_id],
|
||||||
valid_channel_signatures=True)
|
valid_channel_signatures=True, invalid_channel_signatures=False)
|
||||||
|
|
||||||
# abandoned stream won't show up for streams in channel search
|
# abandoned stream won't show up for streams in channel search
|
||||||
await self.stream_abandon(txid=signed2['txid'], nout=0)
|
await self.stream_abandon(txid=signed2['txid'], nout=0)
|
||||||
|
|
Loading…
Reference in a new issue