Skip to content

Commit 1fadfc3

Browse files
committed
Persist note title in collaborative note editing
1 parent 9fc2907 commit 1fadfc3

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

source/app/blueprints/rest/case/case_notes_routes.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,8 @@ def case_note_collab_persist(cur_id, caseid):
201201
return response_error('Data error', data={'note_content': ['Missing note content']})
202202

203203
note.note_content = request_data.get('note_content')
204+
if isinstance(request_data.get('note_title'), str) and request_data.get('note_title'):
205+
note.note_title = request_data.get('note_title')
204206
note = notes_update(iris_current_user, note)
205207

206208
return response_success('ok', data={

ui/src/pages/case.notes.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ function reset_note_collab_state(markdown) {
5757
function note_collab_payload(markdown) {
5858
return {
5959
csrf_token: $('#csrf_token').val(),
60+
note_title: $('#currentNoteTitle').text() ? $('#currentNoteTitle').text() : $('#currentNoteTitleInput').val(),
6061
note_content: markdown || '',
6162
client_hash: window.IrisCollabSession.hashContent(markdown || ''),
6263
};
@@ -829,12 +830,21 @@ function save_note() {
829830
note_collab_persist_timer = null;
830831
}
831832
const md = get_active_note_markdown();
833+
const currentNoteTitle = $('#currentNoteTitle').text() ? $('#currentNoteTitle').text() : $('#currentNoteTitleInput').val();
834+
const titleChanged = previousNoteTitle !== currentNoteTitle;
832835
$('#btn_save_note').text("Snapshotting").removeClass('btn-success btn-danger').addClass('btn-warning');
833-
note_collab_persist_and_snapshot(n_id, md, { forceSnapshot: true })
836+
note_collab_persist_and_snapshot(n_id, md, { forcePersist: titleChanged, forceSnapshot: true })
834837
.then((result) => {
835838
notify_success(result.revision_created
836839
? 'Note snapshot created.'
837840
: 'Note already matches latest snapshot.');
841+
if (titleChanged) {
842+
load_directories().then(function() {
843+
$('.note').removeClass('note-highlight');
844+
$('#note-' + n_id).addClass('note-highlight');
845+
});
846+
previousNoteTitle = currentNoteTitle;
847+
}
838848
})
839849
.catch(() => {
840850
$('#btn_save_note').text("Snapshot error").removeClass('btn-success btn-warning').addClass('btn-danger');

0 commit comments

Comments
 (0)