reflect stream_type on repost searches

This commit is contained in:
Victor Shyba 2021-08-04 11:41:44 -03:00 committed by Victor Shyba
parent 976b4affd9
commit aee87693f8
2 changed files with 4 additions and 2 deletions

View file

@ -820,6 +820,7 @@ class SQLDB:
(select group_concat(language, ' ') from language where language.claim_hash in (claim.claim_hash, claim.reposted_claim_hash)) as languages,
(select cr.has_source from claim cr where cr.claim_hash = claim.reposted_claim_hash) as reposted_has_source,
(select cr.claim_type from claim cr where cr.claim_hash = claim.reposted_claim_hash) as reposted_claim_type,
(select cr.stream_type from claim cr where cr.claim_hash = claim.reposted_claim_hash) as reposted_stream_type,
claim.*
FROM claim LEFT JOIN claimtrie USING (claim_hash)
WHERE claim.claim_hash in (SELECT claim_hash FROM changelog)
@ -830,6 +831,7 @@ class SQLDB:
claim['censor_type'] = 0
censoring_channel_hash = None
claim['has_source'] = bool(claim.pop('reposted_has_source') or claim['has_source'])
claim['stream_type'] = claim.pop('reposted_stream_type') or claim['stream_type']
for reason_id in id_set:
if reason_id in self.blocked_streams:
claim['censor_type'] = 2

View file

@ -490,8 +490,8 @@ class ClaimSearchCommand(ClaimTestCase):
# stream_type
await self.assertFindsClaims([octet, unknown], stream_types=['binary'])
await self.assertFindsClaims([video], stream_types=['video'])
await self.assertFindsClaims([image], stream_types=['image'])
await self.assertFindsClaims([image, video], stream_types=['video', 'image'])
await self.assertFindsClaims([repost, image], stream_types=['image'])
await self.assertFindsClaims([repost, image, video], stream_types=['video', 'image'])
# media_type
await self.assertFindsClaims([octet, unknown], media_types=['application/octet-stream'])