settings: clean the deprecated "allowUserSettings" + fix gear icon showing when plugin has no settings

This commit is contained in:
Lemmy
2026-01-30 11:10:12 -05:00
parent 9f14ca21e6
commit 0acca7d2d3
8 changed files with 9 additions and 24 deletions
+2 -2
View File
@@ -1111,7 +1111,7 @@ Singleton {
// Delete deprecated user settings from the wiget
for (const k of Object.keys(widget)) {
if (k === "id" || k === "allowUserSettings") {
if (k === "id") {
continue;
}
if (!keys.includes(k)) {
@@ -1122,7 +1122,7 @@ Singleton {
// Inject missing default setting (metaData) from BarWidgetRegistry
for (var i = 0; i < keys.length; i++) {
const k = keys[i];
if (k === "id" || k === "allowUserSettings") {
if (k === "id") {
continue;
}
+1 -3
View File
@@ -83,9 +83,7 @@ Variants {
var metadata = DesktopWidgetRegistry.widgetMetadata[widgetId];
if (metadata) {
Object.keys(metadata).forEach(function (key) {
if (key !== "allowUserSettings") {
newWidget[key] = metadata[key];
}
newWidget[key] = metadata[key];
});
}
@@ -44,9 +44,7 @@ NBox {
var metadata = BarWidgetRegistry.widgetMetadata[widgetId];
if (metadata) {
Object.keys(metadata).forEach(function (key) {
if (key !== "allowUserSettings") {
newWidget[key] = metadata[key];
}
newWidget[key] = metadata[key];
});
}
}
+1 -3
View File
@@ -33,9 +33,7 @@ ColumnLayout {
var metadata = BarWidgetRegistry.widgetMetadata[widgetId];
if (metadata) {
Object.keys(metadata).forEach(function (key) {
if (key !== "allowUserSettings") {
newWidget[key] = metadata[key];
}
newWidget[key] = metadata[key];
});
}
}
@@ -184,9 +184,7 @@ ColumnLayout {
var metadata = ControlCenterWidgetRegistry.widgetMetadata[widgetId];
if (metadata) {
Object.keys(metadata).forEach(function (key) {
if (key !== "allowUserSettings") {
newWidget[key] = metadata[key];
}
newWidget[key] = metadata[key];
});
}
}
@@ -234,9 +234,7 @@ ColumnLayout {
var metadata = DesktopWidgetRegistry.widgetMetadata[widgetId];
if (metadata) {
Object.keys(metadata).forEach(function (key) {
if (key !== "allowUserSettings") {
newWidget[key] = metadata[key];
}
newWidget[key] = metadata[key];
});
}
}
+1 -6
View File
@@ -372,12 +372,7 @@ Singleton {
// Helper function to check if widget has user settings
function widgetHasUserSettings(id) {
var meta = widgetMetadata[id];
if (meta === undefined)
return false;
// allowUserSettings=false lets a widget opt out of the settings dialog
if (meta.allowUserSettings === false)
return false;
return true;
return (meta !== undefined);
}
// ------------------------------
+1 -1
View File
@@ -111,7 +111,7 @@ NBox {
return [Color.mPrimary, Color.mOnPrimary];
}
// Check if widget has settings (either core widget with allowUserSettings or plugin with settings entry point)
// Check if widget has settings (either core widget with metadata or plugin with settings entry point)
function widgetHasSettings(widgetId) {
// Check if it's a core widget with user settings
if (root.widgetRegistry && root.widgetRegistry.widgetHasUserSettings(widgetId)) {