feat: Added a conflict resolution dialog and a Conflicts view for easier management of conflicts (#2337)
This commit is contained in:
@@ -187,6 +187,8 @@ export abstract class Collection<
|
||||
const conflictOf = element.content.conflict_of
|
||||
if (conflictOf) {
|
||||
this.conflictMap.establishRelationship(conflictOf, element.uuid)
|
||||
} else if (this.conflictMap.getInverseRelationships(element.uuid).length > 0) {
|
||||
this.conflictMap.removeFromMap(element.uuid)
|
||||
}
|
||||
|
||||
this.referenceMap.setAllRelationships(
|
||||
@@ -203,6 +205,9 @@ export abstract class Collection<
|
||||
|
||||
if (element.deleted) {
|
||||
this.nondeletedIndex.delete(element.uuid)
|
||||
if (this.conflictMap.getInverseRelationships(element.uuid).length > 0) {
|
||||
this.conflictMap.removeFromMap(element.uuid)
|
||||
}
|
||||
} else {
|
||||
this.nondeletedIndex.add(element.uuid)
|
||||
}
|
||||
@@ -260,4 +265,8 @@ export abstract class Collection<
|
||||
remove(array, { uuid: element.uuid as never })
|
||||
this.typedMap[element.content_type] = array
|
||||
}
|
||||
|
||||
public numberOfItemsWithConflicts(): number {
|
||||
return this.conflictMap.directMapSize
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ export class TagItemsIndex implements SNIndex {
|
||||
|
||||
private isItemCountable = (item: ItemInterface) => {
|
||||
if (isDecryptedItem(item)) {
|
||||
return !item.archived && !item.trashed
|
||||
return !item.archived && !item.trashed && !item.conflictOf
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -10,8 +10,9 @@ import { FilterDisplayOptions } from './DisplayOptions'
|
||||
export function computeUnifiedFilterForDisplayOptions(
|
||||
options: FilterDisplayOptions,
|
||||
collection: ReferenceLookupCollection,
|
||||
additionalFilters: ItemFilter[] = [],
|
||||
): ItemFilter {
|
||||
const filters = computeFiltersForDisplayOptions(options, collection)
|
||||
const filters = computeFiltersForDisplayOptions(options, collection).concat(additionalFilters)
|
||||
|
||||
return (item: SearchableDecryptedItem) => {
|
||||
return itemPassesFilters(item, filters)
|
||||
@@ -74,5 +75,9 @@ export function computeFiltersForDisplayOptions(
|
||||
filters.push((item) => itemMatchesQuery(item, query, collection))
|
||||
}
|
||||
|
||||
if (!viewsPredicate?.keypathIncludesString('conflict_of')) {
|
||||
filters.push((item) => !item.conflictOf)
|
||||
}
|
||||
|
||||
return filters
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user