Fix duplicate conflicting add-on names being shown (#1489)

This commit is contained in:
Abdo 2021-11-14 04:36:32 +03:00 committed by GitHub
parent 90e7ee2e18
commit a7afa15462
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -53,7 +53,7 @@ class AbortAddonImport(Exception):
@dataclass @dataclass
class InstallOk: class InstallOk:
name: str name: str
conflicts: list[str] conflicts: set[str]
compatible: bool compatible: bool
@ -354,14 +354,12 @@ class AddonManager:
all_conflicts[other_dir].append(addon.dir_name) all_conflicts[other_dir].append(addon.dir_name)
return all_conflicts return all_conflicts
def _disableConflicting(self, dir: str, conflicts: list[str] = None) -> list[str]: def _disableConflicting(self, dir: str, conflicts: list[str] = None) -> set[str]:
conflicts = conflicts or self.addonConflicts(dir) conflicts = conflicts or self.addonConflicts(dir)
installed = self.allAddons() installed = self.allAddons()
found = [d for d in conflicts if d in installed and self.isEnabled(d)] found = {d for d in conflicts if d in installed and self.isEnabled(d)}
found.extend(self.allAddonConflicts().get(dir, [])) found.update(self.allAddonConflicts().get(dir, []))
if not found:
return []
for package in found: for package in found:
self.toggleEnabled(package, enable=False) self.toggleEnabled(package, enable=False)