mdSilo / mdSilo-app

Lightweight Knowledge Base and Feed Reader.
https://mdsilo.com/
GNU Affero General Public License v3.0
565 stars 39 forks source link

feat: use `updated_at` file property (stat's `modify` time) for Chronicle view #561

Closed pdecat closed 10 months ago

pdecat commented 10 months ago

Hi, I'm currently migrating from another note taking tool (Zim) which does not use the same formatting language, so I needed to mass modify my files to convert them to Markdown format using sed (can share the commands if anyone is interested).

While doing so, I've noticed that all my files would appear in the Chronicle view from today's date. Obviously, that's because my sed commands modified all the files. I went on and restored the modify time from a backup of the original files using find . -name "*.txt" -exec bash -c 'touch -t $(date -d @$(stat --format '%Y' "../Notes.bak/{}") +%Y%m%d%H%M.%S) "{}"' \; -ls, but the Chronicle view would still show all notes as made today. Looking at the source, I then figured that view is using the files creation time (stat's birth time), and my sed commands using inline mode created new files. But the notion of file creation date on Linux is file system dependent, and there's no easy way to alter it.

With the change in this PRs, the Chronicle view uses the updated_at file property (stat's modify time), and notes appear when they were last modified.

If the original behavior is intended by some people, maybe it would make sense to make it an option.

PS: sorry about the trailing spaces removal changes that pollute the diff, I can revert those if desired.

danloh commented 10 months ago

Thanks ^_^