mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-10-23 11:44:00 -04:00
sysupdate: hide flatpak updates when flatpak is excluded
Port 2.0
This commit is contained in:
@@ -61,7 +61,7 @@ Item {
|
||||
readonly property bool busy: SystemUpdateService.isChecking || SystemUpdateService.isUpgrading
|
||||
// A refresh clears the log, so a log next to an error means the upgrade itself failed.
|
||||
readonly property bool upgradeFailed: SystemUpdateService.hasError && !busy && (SystemUpdateService.recentLog || []).length > 0
|
||||
readonly property var installablePackages: SystemUpdateService.availableUpdates.filter(p => SettingsData.updaterIncludeFlatpak || p.repo !== "flatpak")
|
||||
readonly property var installablePackages: SystemUpdateService.availableUpdates
|
||||
readonly property bool anythingToInstall: installablePackages.length > 0 && SystemUpdateService.helperAvailable
|
||||
readonly property var notesRelease: SystemUpdateService.notesRelease
|
||||
readonly property int serviceLastCheckUnix: SystemUpdateService.lastCheckUnix
|
||||
|
||||
@@ -124,6 +124,9 @@ Singleton {
|
||||
function onUpdaterAllowAURChanged() {
|
||||
root._refilter();
|
||||
}
|
||||
function onUpdaterIncludeFlatpakChanged() {
|
||||
root._refilter();
|
||||
}
|
||||
function onUpdaterIgnoredPackagesChanged() {
|
||||
root._refilter();
|
||||
}
|
||||
@@ -275,6 +278,8 @@ Singleton {
|
||||
return (pkgs || []).filter(p => {
|
||||
if (!SettingsData.updaterAllowAUR && p.repo === "aur")
|
||||
return false;
|
||||
if (!SettingsData.updaterIncludeFlatpak && p.repo === "flatpak")
|
||||
return false;
|
||||
if (!canIgnorePackage(p))
|
||||
return true;
|
||||
return !_isIgnored(p);
|
||||
|
||||
@@ -12,7 +12,7 @@ const extract = (name) => {
|
||||
};
|
||||
|
||||
const scope = vm.createContext({
|
||||
SettingsData: { updaterIgnoredPackages: [], updaterAllowAUR: true },
|
||||
SettingsData: { updaterIgnoredPackages: [], updaterAllowAUR: true, updaterIncludeFlatpak: true },
|
||||
pkgManager: "portage",
|
||||
systemHoldsAllowed: true,
|
||||
});
|
||||
@@ -59,3 +59,16 @@ test("portage ignores drop the update from the list", () => {
|
||||
const kept = scope._filterUpdates(pkgs);
|
||||
assert.deepEqual(kept.map(p => p.name), ["mail-client/thunderbird"]);
|
||||
});
|
||||
|
||||
test("excluded flatpak updates are dropped from the list", () => {
|
||||
scope.SettingsData.updaterIgnoredPackages = [];
|
||||
const pkgs = [
|
||||
{ name: "org.freedesktop.Platform", repo: "flatpak", backend: "flatpak" },
|
||||
{ name: "mail-client/thunderbird", repo: "gentoo (ebuild)", backend: "portage" },
|
||||
];
|
||||
for (const [include, want] of [[true, ["org.freedesktop.Platform", "mail-client/thunderbird"]], [false, ["mail-client/thunderbird"]]]) {
|
||||
scope.SettingsData.updaterIncludeFlatpak = include;
|
||||
assert.deepEqual(scope._filterUpdates(pkgs).map(p => p.name), want, `includeFlatpak=${include}`);
|
||||
}
|
||||
scope.SettingsData.updaterIncludeFlatpak = true;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user