refactor: fix conflicts view when conflicted copies are already in trash (#2339)

This commit is contained in:
Aman Harwara
2023-06-27 22:08:46 +05:30
committed by GitHub
parent f858f31492
commit d3378a704a
7 changed files with 102 additions and 35 deletions

View File

@@ -185,10 +185,13 @@ export abstract class Collection<
if (this.isDecryptedElement(element)) {
const conflictOf = element.content.conflict_of
if (conflictOf) {
if (conflictOf && !element.content.trashed) {
this.conflictMap.establishRelationship(conflictOf, element.uuid)
}
const isConflictOfButTrashed = conflictOf && element.content.trashed
const isInConflictMapButIsNotConflictOf =
!conflictOf && this.conflictMap.getInverseRelationships(element.uuid).length > 0
@@ -196,7 +199,7 @@ export abstract class Collection<
this.conflictMap.existsInDirectMap(element.uuid) &&
this.conflictMap.getDirectRelationships(element.uuid).length === 0
if (isInConflictMapButIsNotConflictOf || isInConflictMapButDoesNotHaveConflicts) {
if (isInConflictMapButIsNotConflictOf || isInConflictMapButDoesNotHaveConflicts || isConflictOfButTrashed) {
this.conflictMap.removeFromMap(element.uuid)
}