mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-24 00:50:35 +00:00
Don't show broken image previews when cover is absent
This commit is contained in:
parent
6d7b3e9ae7
commit
15790abc70
2 changed files with 6 additions and 2 deletions
|
@ -6,7 +6,7 @@ from .abstract_connector import AbstractMinimalConnector, SearchResult
|
|||
class Connector(AbstractMinimalConnector):
|
||||
"""this is basically just for search"""
|
||||
|
||||
def get_or_create_book(self, remote_id, work=None):
|
||||
def get_or_create_book(self, remote_id):
|
||||
return activitypub.resolve_remote_id(remote_id, model=models.Edition)
|
||||
|
||||
def parse_search_data(self, data):
|
||||
|
|
|
@ -69,6 +69,10 @@ class Connector(AbstractConnector):
|
|||
return search_results
|
||||
|
||||
def format_search_result(self, search_result):
|
||||
cover = None
|
||||
if search_result.cover:
|
||||
cover = "%s%s" % (self.covers_url, search_result.cover)
|
||||
|
||||
return SearchResult(
|
||||
title=search_result.title,
|
||||
key=search_result.remote_id,
|
||||
|
@ -77,7 +81,7 @@ class Connector(AbstractConnector):
|
|||
if search_result.published_date
|
||||
else None,
|
||||
connector=self,
|
||||
cover="%s%s" % (self.covers_url, search_result.cover),
|
||||
cover=cover,
|
||||
confidence=search_result.rank if hasattr(search_result, "rank") else 1,
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in a new issue