1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-24 10:27:10 +02:00

All: Refresh sidebar and notes when moving note outside of conflict folder

This commit is contained in:
Laurent Cozic 2020-11-19 16:21:24 +00:00
parent a40ab434ca
commit 61618fb37c
3 changed files with 14 additions and 4 deletions

View File

@ -542,7 +542,11 @@ export default class BaseApplication {
}
if (action.type === 'NOTE_UPDATE_ONE') {
if (!action.changedFields.length || action.changedFields.includes('parent_id') || action.changedFields.includes('encryption_applied')) {
if (!action.changedFields.length ||
action.changedFields.includes('parent_id') ||
action.changedFields.includes('encryption_applied') ||
action.changedFields.includes('is_conflict')
) {
refreshFolders = true;
}
}

View File

@ -276,7 +276,7 @@ class Note extends BaseItem {
includeTimestamps: true,
}, options);
const output = ['id', 'title', 'is_todo', 'todo_completed', 'todo_due', 'parent_id', 'encryption_applied', 'order', 'markup_language'];
const output = ['id', 'title', 'is_todo', 'todo_completed', 'todo_due', 'parent_id', 'encryption_applied', 'order', 'markup_language', 'is_conflict'];
if (options.includeTimestamps) {
output.push('updated_time');

View File

@ -787,8 +787,14 @@ const reducer = produce((draft: Draft<State> = defaultState, action: any) => {
for (let i = 0; i < newNotes.length; i++) {
const n = newNotes[i];
if (n.id == modNote.id) {
// Note is still in the same folder
if (isViewingAllNotes || noteIsInFolder(modNote, n.parent_id)) {
if (n.is_conflict && !modNote.is_conflict) {
// Note was a conflict but was moved outside of
// the conflict folder
newNotes.splice(i, 1);
noteFolderHasChanged = true;
movedNotePreviousIndex = i;
} else if (isViewingAllNotes || noteIsInFolder(modNote, n.parent_id)) {
// Note is still in the same folder
// Merge the properties that have changed (in modNote) into
// the object we already have.
newNotes[i] = Object.assign({}, newNotes[i]);