Skip to content

Commit

Permalink
trigger note revisioning saving also on title changes zadam#2426
Browse files Browse the repository at this point in the history
  • Loading branch information
zadam committed Dec 8, 2021
1 parent 263b7a8 commit a810c08
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/public/app/dialogs/options/other.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const TPL = `
<div class="form-group">
<label for="image-max-width-height">Max width / height of an image in pixels (image will be resized if it exceeds this setting).</label>
<input class="form-control" id="image-max-width-height" type="number">
<input class="form-control" id="image-max-width-height" type="number" min="1">
</div>
<div class="form-group">
Expand Down Expand Up @@ -67,7 +67,7 @@ const TPL = `
<div class="form-group">
<label for="protected-session-timeout-in-seconds">Protected session timeout (in seconds)</label>
<input class="form-control" id="protected-session-timeout-in-seconds" type="number">
<input class="form-control" id="protected-session-timeout-in-seconds" type="number" min="60">
</div>
</div>
Expand All @@ -78,7 +78,7 @@ const TPL = `
<div class="form-group">
<label for="note-revision-snapshot-time-interval-in-seconds">Note revision snapshot time interval (in seconds)</label>
<input class="form-control" id="note-revision-snapshot-time-interval-in-seconds" type="number">
<input class="form-control" id="note-revision-snapshot-time-interval-in-seconds" type="number" min="10">
</div>
</div>
Expand All @@ -89,12 +89,12 @@ const TPL = `
<div class="form-group">
<label for="auto-readonly-size-text">Automatic readonly size (text notes)</label>
<input class="form-control" id="auto-readonly-size-text" type="number">
<input class="form-control" id="auto-readonly-size-text" type="number" min="0">
</div>
<div class="form-group">
<label for="auto-readonly-size-code">Automatic readonly size (code notes)</label>
<input class="form-control" id="auto-readonly-size-code" type="number">
<input class="form-control" id="auto-readonly-size-code" type="number" min="0">
</div>
</div>`;

Expand Down
4 changes: 4 additions & 0 deletions src/routes/api/notes.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,10 @@ function changeTitle(req) {

const noteTitleChanged = note.title !== title;

if (noteTitleChanged) {
noteService.saveNoteRevision(note);
}

note.title = title;

note.save();
Expand Down
3 changes: 2 additions & 1 deletion src/services/notes.js
Original file line number Diff line number Diff line change
Expand Up @@ -918,5 +918,6 @@ module.exports = {
getUndeletedParentBranchIds,
triggerNoteTitleChanged,
eraseDeletedNotesNow,
eraseNotesWithDeleteId
eraseNotesWithDeleteId,
saveNoteRevision
};

0 comments on commit a810c08

Please sign in to comment.