diff --git a/src/views/admin/partials/widget-settings.tpl b/src/views/admin/partials/widget-settings.tpl
index 87d60ea2f1..2549b27d1b 100644
--- a/src/views/admin/partials/widget-settings.tpl
+++ b/src/views/admin/partials/widget-settings.tpl
@@ -6,24 +6,7 @@
-
-
-
-
-
-
-
-
-
-
+
diff --git a/src/views/admin/partials/widgets/show_hide_groups.tpl b/src/views/admin/partials/widgets/show_hide_groups.tpl
new file mode 100644
index 0000000000..a640c27716
--- /dev/null
+++ b/src/views/admin/partials/widgets/show_hide_groups.tpl
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/widgets/index.js b/src/widgets/index.js
index eac16373fc..572121b021 100644
--- a/src/widgets/index.js
+++ b/src/widgets/index.js
@@ -50,7 +50,7 @@ async function renderWidget(widget, uid, options) {
return;
}
- const isVisible = await checkVisibility(widget, uid);
+ const isVisible = await widgets.checkVisibility(widget.data, uid);
if (!isVisible) {
return;
}
@@ -92,17 +92,17 @@ async function renderWidget(widget, uid, options) {
return { html };
}
-async function checkVisibility(widget, uid) {
+widgets.checkVisibility = async function (data, uid) {
let isVisible = true;
let isHidden = false;
- if (widget.data.groups.length) {
- isVisible = await groups.isMemberOfAny(uid, widget.data.groups);
+ if (data.groups.length) {
+ isVisible = await groups.isMemberOfAny(uid, data.groups);
}
- if (widget.data.groupsHideFrom.length) {
- isHidden = await groups.isMemberOfAny(uid, widget.data.groupsHideFrom);
+ if (data.groupsHideFrom.length) {
+ isHidden = await groups.isMemberOfAny(uid, data.groupsHideFrom);
}
return isVisible && !isHidden;
-}
+};
widgets.getWidgetDataForTemplates = async function (templates) {
const keys = templates.map(tpl => `widgets:${tpl}`);