Clear preview only when the previewed post is blacklisted
Compare cached file path to determine if the right-clicked post is the same one being previewed before clearing.
This commit is contained in:
parent
8d3e3d97f6
commit
9518f95a3c
@ -1427,10 +1427,21 @@ class BooruApp(QMainWindow):
|
|||||||
tag = action.text()
|
tag = action.text()
|
||||||
self._db.add_blacklisted_tag(tag)
|
self._db.add_blacklisted_tag(tag)
|
||||||
self._db.set_setting("blacklist_enabled", "1")
|
self._db.set_setting("blacklist_enabled", "1")
|
||||||
|
# Clear preview if the previewed post has this tag
|
||||||
|
if self._preview._current_path and tag in post.tag_list:
|
||||||
|
from ..core.cache import cached_path_for
|
||||||
|
cp = str(cached_path_for(post.file_url))
|
||||||
|
if cp == self._preview._current_path:
|
||||||
|
self._preview.clear()
|
||||||
self._status.showMessage(f"Blacklisted: {tag}")
|
self._status.showMessage(f"Blacklisted: {tag}")
|
||||||
self._do_search()
|
self._do_search()
|
||||||
elif action == bl_post_action:
|
elif action == bl_post_action:
|
||||||
self._db.add_blacklisted_post(post.file_url)
|
self._db.add_blacklisted_post(post.file_url)
|
||||||
|
# Clear preview if this is the previewed post
|
||||||
|
from ..core.cache import cached_path_for
|
||||||
|
cp = str(cached_path_for(post.file_url))
|
||||||
|
if cp == self._preview._current_path:
|
||||||
|
self._preview.clear()
|
||||||
self._status.showMessage(f"Post #{post.id} blacklisted")
|
self._status.showMessage(f"Post #{post.id} blacklisted")
|
||||||
self._do_search()
|
self._do_search()
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user