Skip to content
This repository has been archived by the owner on Feb 6, 2025. It is now read-only.

Modify SyncArticlesCommand to check and update existing notes #22

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gwutz
Copy link
Contributor

@gwutz gwutz commented Jul 28, 2023

This is the proof of concept if the sync behaviour is fine according to the idea sketched in #21

Updated the 'SyncArticlesCommand' to check for existing notes before creating new ones. If an existing note is found, it checks whether special marker tags are present and whether it was synchronized previously. This prevents overwriting existing notes with the same name, or recreating previously synchronized notes, improving data consistency and reliability.
@peterrus
Copy link
Contributor

Hey @gwutz, I'd also be interested in this. I suppose you are using this to update your notes after you made highlighting/note changes in Wallabag?

I'd be willing to test this, could you give me a short rundown of what I need to do to build the plugin?

@gwutz
Copy link
Contributor Author

gwutz commented Aug 17, 2023

@peterrus Just place that main.js and manifest.json file in your vaults .obsidian/plugins/obsidian-wallabag folder. But note that will overwrite the existing plugin and enhances it with my take on syncing. So it makes sense to keep a copy of that folder somewhere (just to avoid data corruption, which should not happen in theory but my laywer suggests to add this haha :) )

If you don't trust me, then just download that branch from me and execute npm install and npm run build which will create a main.js file in the root of the folder. The manifest.json already exists and is needed for obsidian

obsidian-wallabag.zip

@jeffbeaulieu
Copy link
Contributor

jeffbeaulieu commented Aug 18, 2023

I suggest that we add a parameter (as was done for "Sync archived items") to update the notes from Wallabag on sync ("Update notes from Wallabag on Sync").
This would ensure that the current behavior would be retained by default for current users, without requiring the addition of tags in obsidian notes.
If necessary we can also add a parameter to define the tag that prevents the update of certain notes from Wallabag.

@peterrus
Copy link
Contributor

Haven't got around to testing this yet but I agree that the default behavior should be to not overwrite notes.

When the 'update notes from wallabag on sync' option is enabled it should indeed try to update all notes, except the ones that have the #wallakeep frontmatter tag (and not crash when someone doesn't use frontmatter).

Of course the current PR is a PoC so I understand why that hasn't been integrated yet.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants