From 9cd4d84a4a87e8bfa4da8c39ac894c71d9287656 Mon Sep 17 00:00:00 2001 From: Guy Van Sanden Date: Thu, 16 Apr 2026 20:55:54 +0200 Subject: [PATCH] v1.0.44 - debug OCS response --- appinfo/info.xml | 2 +- js/minimalprofile.js | 16 +++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/appinfo/info.xml b/appinfo/info.xml index 7f283a1..cf6bbaf 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -4,7 +4,7 @@ Minimal Profile Hides profile fields to create a minimal user profile Allows administrators to hide profile fields like pronouns, social links, etc. - 1.0.43 + 1.0.44 AGPL Your Name MinimalProfile diff --git a/js/minimalprofile.js b/js/minimalprofile.js index cd42d99..09e1fad 100644 --- a/js/minimalprofile.js +++ b/js/minimalprofile.js @@ -1,5 +1,5 @@ /** - * MinimalProfile v42 - OCS API + * MinimalProfile v43 - Debug OCS response */ (function() { 'use strict'; @@ -8,7 +8,7 @@ return; } - console.log('MinimalProfile v42: Starting'); + console.log('MinimalProfile v43: Starting'); var map = { 'pronouns': '#account-property-pronouns', @@ -38,20 +38,22 @@ var xhr = new XMLHttpRequest(); xhr.open('GET', '/ocs/v2.php/apps/minimalprofile/api/v1/hidden-fields', true); xhr.onload = function() { + console.log('MinimalProfile v43: Response status', xhr.status, 'body:', xhr.responseText.substring(0, 200)); if (xhr.status === 200) { try { var data = JSON.parse(xhr.responseText); - console.log('MinimalProfile v42: API returned', data.ocs.data.hiddenFields); - hideFields(data.ocs.data.hiddenFields); + var fields = data?.ocs?.data?.hiddenFields; + console.log('MinimalProfile v43: API returned', fields); + hideFields(fields); } catch(e) { - console.error('MinimalProfile v42: JSON parse error', e); + console.error('MinimalProfile v43: JSON parse error', e); } } else { - console.error('MinimalProfile v42: API failed', xhr.status); + console.error('MinimalProfile v43: API failed', xhr.status); } }; xhr.onerror = function() { - console.error('MinimalProfile v42: Network error'); + console.error('MinimalProfile v43: Network error'); }; xhr.send(); }