summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorCôme Chilliet <come.chilliet@nextcloud.com>2024-01-09 16:43:46 +0100
committerJohn Molakvoæ <skjnldsv@protonmail.com>2024-01-15 15:11:58 +0100
commit18533bba135c13304ac6fc1c87ff58958d4f888c (patch)
tree092b9f7f69548c156449b72942406e7712bedcac /core
parentc335d369e11a59e73858ace4fac88d92e2fabecb (diff)
downloadnextcloud-server-18533bba135c13304ac6fc1c87ff58958d4f888c.tar.gz
nextcloud-server-18533bba135c13304ac6fc1c87ff58958d4f888c.zip
Fix UI for rich object in setupcheck results
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'core')
-rw-r--r--core/js/setupchecks.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/core/js/setupchecks.js b/core/js/setupchecks.js
index 24fec85aeb3..925c6924f26 100644
--- a/core/js/setupchecks.js
+++ b/core/js/setupchecks.js
@@ -380,6 +380,28 @@
return deferred.promise();
},
+ /**
+ * @param message The message string containing placeholders.
+ * @param parameters An object with keys as placeholders and values as their replacements.
+ *
+ * @return The message with placeholders replaced by values.
+ */
+ richToParsed: function (message, parameters) {
+ for (var [placeholder, parameter] of Object.entries(parameters)) {
+ var replacement;
+ if (parameter.type === 'user') {
+ replacement = '@' + parameter.name;
+ } else if (parameter.type === 'file') {
+ replacement = parameter.path || parameter.name;
+ } else {
+ replacement = parameter.name;
+ }
+ message = message.replace('{' + placeholder + '}', replacement);
+ }
+
+ return message;
+ },
+
addGenericSetupCheck: function(data, check, messages) {
var setupCheck = data[check] || { pass: true, description: '', severity: 'info', linkToDoc: null}
@@ -391,6 +413,9 @@
}
var message = setupCheck.description;
+ if (setupCheck.descriptionParameters) {
+ message = this.richToParsed(message, setupCheck.descriptionParameters);
+ }
if (setupCheck.linkToDoc) {
message += ' ' + t('core', 'For more details see the {linkstart}documentation ↗{linkend}.')
.replace('{linkstart}', '<a target="_blank" rel="noreferrer noopener" class="external" href="' + setupCheck.linkToDoc + '">')