linickx/snsync

Maintain "systemtags"

Closed this issue · 2 comments

When syncing a locally modified file with simpenote, all systemtags are cleared.

Steps to Reproduce:

  1. Create a note in Simplenote
  2. Set note as "pinned" or "markdown" in Simpenote
  3. Sync with snsync
  4. Edit the new file with any text editor, and save it
  5. Sync with snsync
  6. Open file in Simplenote.
  7. The note is neither "pinned" nor "markdown" viewable.

Background: I wrote a bash script to update filenames and their associated entries in the "notefile" table based on the first line and whether or not the "markdown" systemtag is present in the "simplenote" table. Everything works exactly how I want except when a .md file is updated locally between syncs. It ends up becoming a .txt file again because the systemtags field is empty for the record. I verified this behavior occurs without my script, and the repro steps above should work without needing to query the sqlite db.

Hi Thanks & Ack ... I use pinned/markdown but have not noticed this, but will take a look.

Before

2019-11-03 19:38:11,064 [DEBUG] Looking for SN: 32e7cc390f87fc03f6decf28723b0882
2019-11-03 19:38:11,071 [DEBUG] 404 Not Found: 32e7cc390f87fc03f6decf28723b0882
2019-11-03 19:38:11,071 [INFO] Adding SN NOTE: 32e7cc390f87fc03f6decf28723b0882 to Local DB
2019-11-03 19:38:11,071 [DEBUG] Updating SN Database: {'tags': [], 'deleted': False, 'shareURL': '', 'systemTags': ['pinned', 'markdown'], 'content': 'N3w Not3\n----------\n\nABC 123\n\n\n\n\n```\nWhen syncing a locally modified file with simpenote, all systemtags are cleared.\n\nSteps to Reproduce:\n\nCreate a note in Simplenote\nSet note as "pinned" or "markdown" in Simpenote\nSync with snsync\nEdit the new file with any text editor, and save it\nSync with snsync\nOpen file in Simplenote.\nThe note is neither "pinned" nor "markdown" viewable.\nBackground: I wrote a bash script to update filenames and their associated entries in the "notefile" table based on the first line and whether or not the "markdown" systemtag is present in the "simplenote" table. Everything works exactly how I want except when a .md file is updated locally between syncs. It ends up becoming a .txt file again because the systemtags field is empty for the record. I verified this behavior occurs without my script, and the repro steps above should work without needing to query the sqlite db.\n```', 'publishURL': '', 'modificationDate': 1572809843.675, 'creationDate': 1572809782.483, 'key': '32e7cc390f87fc03f6decf28723b0882', 'version': 8, 'modifydate': 1572809843.675, 'createdate': 1572809782.483, 'systemtags': ['pinned', 'markdown']}
2019-11-03 19:38:11,695 [DEBUG] API Result: ({'tags': [], 'deleted': False, 'shareURL': '', 'systemTags': ['pinned', 'markdown'], 'content': 'N3w Not3\n----------\n\nABC 123\n\n\n\n\n```\nWhen syncing a locally modified file with simpenote, all systemtags are cleared.\n\nSteps to Reproduce:\n\nCreate a note in Simplenote\nSet note as "pinned" or "markdown" in Simpenote\nSync with snsync\nEdit the new file with any text editor, and save it\nSync with snsync\nOpen file in Simplenote.\nThe note is neither "pinned" nor "markdown" viewable.\nBackground: I wrote a bash script to update filenames and their associated entries in the "notefile" table based on the first line and whether or not the "markdown" systemtag is present in the "simplenote" table. Everything works exactly how I want except when a .md file is updated locally between syncs. It ends up becoming a .txt file again because the systemtags field is empty for the record. I verified this behavior occurs without my script, and the repro steps above should work without needing to query the sqlite db.\n```', 'publishURL': '', 'modificationDate': 1572809843.675, 'creationDate': 1572809782.483, 'key': '32e7cc390f87fc03f6decf28723b0882', 'version': 8, 'modifydate': 1572809843.675, 'createdate': 1572809782.483, 'systemtags': ['pinned', 'markdown']}, 0)
2019-11-03 19:38:11,695 [DEBUG] Make Safe In: N3w Not3 Out: N3w Not3
2019-11-03 19:38:11,704 [INFO] Writing N3w Not3.txt
2019-11-03 19:38:11,704 [DEBUG] Updating Note File DB: {'filename': 'N3w Not3.txt', 'key': '32e7cc390f87fc03f6decf28723b0882', 'createdate': 1572809782.483, 'modifydate': 1572809843.675, 'deleted': False}

After

2019-11-03 19:50:15,266 [DEBUG] Looking for SN: 32e7cc390f87fc03f6decf28723b0882
2019-11-03 19:50:15,273 [DEBUG] SIMPLENOTE: {'key': '32e7cc390f87fc03f6decf28723b0882', 'createdate': 1572809782.483, 'deleted': '0', 'modifydate': 1572809843.675, 'systemtags': '["pinned", "markdown"]', 'tags': '[]', 'version': '8'}
2019-11-03 19:50:15,273 [DEBUG] Looking for NF: 32e7cc390f87fc03f6decf28723b0882
2019-11-03 19:50:15,275 [DEBUG] NOTEFILE: {'key': '32e7cc390f87fc03f6decf28723b0882', 'createdate': '1572809782.483', 'deleted': '0', 'modifydate': '1572809843.675', 'filename': 'N3w Not3.txt'}
2019-11-03 19:50:15,275 [DEBUG] SN Modified: 1572809843 [Sun Nov  3 19:37:23 2019]
2019-11-03 19:50:15,275 [DEBUG] SN (cached) Modified: 1572809843 [Sun Nov  3 19:37:23 2019]
2019-11-03 19:50:15,275 [DEBUG] NF Modified: 1572810587 [Sun Nov  3 19:49:47 2019]
2019-11-03 19:50:15,276 [DEBUG] NF N3w Not3.txt is newer than SN 32e7cc390f87fc03f6decf28723b0882
2019-11-03 19:50:15,276 [INFO] [SN] < [NF] | 32e7cc390f87fc03f6decf28723b0882 <- N3w Not3.txt
2019-11-03 19:50:15,276 [DEBUG] Note File Modified: 1572810587.5459201 [Sun Nov  3 19:49:47 2019]
2019-11-03 19:50:15,277 [DEBUG] Note File Created: 1572809843.675 [Sun Nov  3 19:37:23 2019]
2019-11-03 19:50:16,186 [DEBUG] API Result: ({'tags': [], 'deleted': False, 'shareURL': '', 'systemTags': [], 'content': 'N3w Not3\n----------\n\nABC 123\n\nThese are the changes I\'m making....\n\n\n\n```\nWhen syncing a locally modified file with simpenote, all systemtags are cleared.\n\nSteps to Reproduce:\n\nCreate a note in Simplenote\nSet note as "pinned" or "markdown" in Simpenote\nSync with snsync\nEdit the new file with any text editor, and save it\nSync with snsync\nOpen file in Simplenote.\nThe note is neither "pinned" nor "markdown" viewable.\nBackground: I wrote a bash script to update filenames and their associated entries in the "notefile" table based on the first line and whether or not the "markdown" systemtag is present in the "simplenote" table. Everything works exactly how I want except when a .md file is updated locally between syncs. It ends up becoming a .txt file again because the systemtags field is empty for the record. I verified this behavior occurs without my script, and the repro steps above should work without needing to query the sqlite db.\n```\n', 'publishURL': '', 'modificationDate': 1572810587.5459201, 'creationDate': 1572810615.277118, 'key': '32e7cc390f87fc03f6decf28723b0882', 'version': 9, 'modifydate': 1572810587.5459201, 'createdate': 1572810615.277118, 'systemtags': []}, 0)
2019-11-03 19:50:16,186 [DEBUG] Updating SN Database: {'tags': [], 'deleted': False, 'shareURL': '', 'systemTags': [], 'content': 'N3w Not3\n----------\n\nABC 123\n\nThese are the changes I\'m making....\n\n\n\n```\nWhen syncing a locally modified file with simpenote, all systemtags are cleared.\n\nSteps to Reproduce:\n\nCreate a note in Simplenote\nSet note as "pinned" or "markdown" in Simpenote\nSync with snsync\nEdit the new file with any text editor, and save it\nSync with snsync\nOpen file in Simplenote.\nThe note is neither "pinned" nor "markdown" viewable.\nBackground: I wrote a bash script to update filenames and their associated entries in the "notefile" table based on the first line and whether or not the "markdown" systemtag is present in the "simplenote" table. Everything works exactly how I want except when a .md file is updated locally between syncs. It ends up becoming a .txt file again because the systemtags field is empty for the record. I verified this behavior occurs without my script, and the repro steps above should work without needing to query the sqlite db.\n```\n', 'publishURL': '', 'modificationDate': 1572810587.5459201, 'creationDate': 1572810615.277118, 'key': '32e7cc390f87fc03f6decf28723b0882', 'version': 9, 'modifydate': 1572810587.5459201, 'createdate': 1572810615.277118, 'systemtags': []}
2019-11-03 19:50:16,187 [DEBUG] Updating Note File DB: {'filename': 'N3w Not3.txt', 'key': '32e7cc390f87fc03f6decf28723b0882', 'createdate': 1572810615.277118, 'modifydate': 1572810587.5459201, 'deleted': False}
2019-11-03 19:50:16,188 [INFO] SN Updated [32e7cc390f87fc03f6decf28723b0882] from N3w Not3.txt

Confirmed

New note created in WebGUI and found by 2019-11-03 19:38:11,695 [DEBUG] API Result showing 'systemtags': ['pinned', 'markdown']
After the change, 2019-11-03 19:50:16,186 [DEBUG] API Result: showing 'systemtags': []

😕