mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-12 09:28:31 +02:00
Don't save templated journal entries if the received raw text is the same as the template itself
This commit is contained in:
parent
fe08cfd3ab
commit
00bc9ef3a1
2 changed files with 6 additions and 1 deletions
|
@ -146,6 +146,9 @@ def write_mode(args: "Namespace", config: dict, journal: Journal, **kwargs) -> N
|
||||||
if not raw or raw.isspace():
|
if not raw or raw.isspace():
|
||||||
logging.error("Write mode: couldn't get raw text or entry was empty")
|
logging.error("Write mode: couldn't get raw text or entry was empty")
|
||||||
raise JrnlException(Message(MsgText.NoTextReceived, MsgStyle.NORMAL))
|
raise JrnlException(Message(MsgText.NoTextReceived, MsgStyle.NORMAL))
|
||||||
|
if config["template"] and raw == _get_editor_template(config):
|
||||||
|
logging.error("Write mode: raw text was the same as the template")
|
||||||
|
raise JrnlException(Message(MsgText.NoChangesToTemplate, MsgStyle.NORMAL))
|
||||||
|
|
||||||
logging.debug(
|
logging.debug(
|
||||||
'Write mode: appending raw text to journal "%s": %s', args.journal_name, raw
|
'Write mode: appending raw text to journal "%s": %s', args.journal_name, raw
|
||||||
|
|
|
@ -156,7 +156,9 @@ class MsgText(Enum):
|
||||||
NoTextReceived = """
|
NoTextReceived = """
|
||||||
No entry to save, because no text was received
|
No entry to save, because no text was received
|
||||||
"""
|
"""
|
||||||
|
NoChangesToTemplate = """
|
||||||
|
No entry to save, because the template was not changed
|
||||||
|
"""
|
||||||
# --- Upgrade --- #
|
# --- Upgrade --- #
|
||||||
JournalFailedUpgrade = """
|
JournalFailedUpgrade = """
|
||||||
The following journal{s} failed to upgrade:
|
The following journal{s} failed to upgrade:
|
||||||
|
|
Loading…
Add table
Reference in a new issue