Fix #1939538 [Single metadata edit dialog always chages the tags even if not modified](https://bugs.launchpad.net/calibre/+bug/1939538)

This commit is contained in:
Kovid Goyal 2021-08-12 12:12:30 +05:30
parent e2c9a16829
commit f16d7fb89f
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -1361,7 +1361,8 @@ class RatingEdit(RatingEditor, ToMetadataMixin): # {{{
self.original_val = self.current_val
def commit(self, db, id_):
db.set_rating(id_, self.current_val, notify=False, commit=False)
if self.current_val != self.original_val:
db.set_rating(id_, self.current_val, notify=False, commit=False)
return True
def zero(self):
@ -1441,9 +1442,10 @@ class TagsEdit(EditWithComplete, ToMetadataMixin): # {{{
self.update_items_cache(db.new_api.all_field_names('tags'))
def commit(self, db, id_):
self.books_to_refresh |= db.set_tags(
id_, self.current_val, notify=False, commit=False,
allow_case_change=True)
if self.changed:
self.books_to_refresh |= db.set_tags(
id_, self.current_val, notify=False, commit=False,
allow_case_change=True)
return True
def keyPressEvent(self, ev):