Skip to content

Commit

Permalink
#3200 add: only test for outgoing note links on subfolder change
Browse files Browse the repository at this point in the history
Signed-off-by: Patrizio Bekerle <[email protected]>
  • Loading branch information
pbek committed Jan 14, 2025
1 parent 4449370 commit 7db7570
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/entities/note.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3417,17 +3417,21 @@ QString Note::relativeFilePath(const QString &path) const {
bool Note::handleNoteMoving(Note oldNote) {
const QVector<int> noteIdList = oldNote.findLinkedNoteIds();
const int noteCount = noteIdList.count();

const auto reverseLinkNotes = oldNote.findReverseLinkNotes();
const int reverseLinkNotesCount = reverseLinkNotes.count();
bool result = false;

// Handle incoming note links
if (noteCount >= 0) {
result = handleLinkedNotesAfterMoving(oldNote, noteIdList);
}

if (reverseLinkNotesCount > 0) {
result |= handleReverseLinkedNotesAfterMoving(oldNote, reverseLinkNotes);
// Handle outgoing note links (only needed if subfolder was changed)
if (oldNote.getNoteSubFolderId() != getNoteSubFolderId()) {
const auto reverseLinkNotes = oldNote.findReverseLinkNotes();
const int reverseLinkNotesCount = reverseLinkNotes.count();

if (reverseLinkNotesCount > 0) {
result |= handleReverseLinkedNotesAfterMoving(oldNote, reverseLinkNotes);
}
}

return result;
Expand Down

0 comments on commit 7db7570

Please sign in to comment.