Request for changes in revisions - data - api

hello @laurent

For any type of encryption plugin, flushing previous revisions after encryption is critically essential. Apparently current Data API doesn't allow it do efficiently it seems.

If you provide the go-ahead to approve the PR for modification in revisions data API, @mrjo118 is willing to work on it.

My proposal is to add a new endpoint with this specification:
DELETE /revisions/notes/:note_id
Deletes all revisions for a note with ID :note_id

Currently the existing revisions api does not allow an optimal way to retrieve only revisions for a specific note. Even if we added an api to get only revisions for a specific note, for this plugin it also requires any beforeChangeJson in the item_changes table to be flushed as well, which is only really suitable to implement in a delete for note endpoint.

On a side note, the fact that the create and update revision api’s go to the Revision model directly is somewhat risky. As the client specifies the title and body diff in the api payload, it would be easy to break a user’s revisions for a note, if the diff used in the payload was not evaluated correctly

The way the API is setup the path should be /notes/:id/revisions (/<resource>/:id/<link>).

I'm ok with this change as long as it's relatively small as I don't have time to review a massive PR that changes several core parts of Joplin, especially if it makes the core even more complex than it already is. Just mentioning it so that you don't unnecessarily spend time on this if it turns out it's too big of a change.

2 Likes