v1.0.44 - debug OCS response

This commit is contained in:
2026-04-16 20:55:54 +02:00
parent f847bc8a0a
commit 9cd4d84a4a
2 changed files with 10 additions and 8 deletions

View File

@@ -4,7 +4,7 @@
<name>Minimal Profile</name> <name>Minimal Profile</name>
<summary>Hides profile fields to create a minimal user profile</summary> <summary>Hides profile fields to create a minimal user profile</summary>
<description>Allows administrators to hide profile fields like pronouns, social links, etc.</description> <description>Allows administrators to hide profile fields like pronouns, social links, etc.</description>
<version>1.0.43</version> <version>1.0.44</version>
<licence>AGPL</licence> <licence>AGPL</licence>
<author>Your Name</author> <author>Your Name</author>
<namespace>MinimalProfile</namespace> <namespace>MinimalProfile</namespace>

View File

@@ -1,5 +1,5 @@
/** /**
* MinimalProfile v42 - OCS API * MinimalProfile v43 - Debug OCS response
*/ */
(function() { (function() {
'use strict'; 'use strict';
@@ -8,7 +8,7 @@
return; return;
} }
console.log('MinimalProfile v42: Starting'); console.log('MinimalProfile v43: Starting');
var map = { var map = {
'pronouns': '#account-property-pronouns', 'pronouns': '#account-property-pronouns',
@@ -38,20 +38,22 @@
var xhr = new XMLHttpRequest(); var xhr = new XMLHttpRequest();
xhr.open('GET', '/ocs/v2.php/apps/minimalprofile/api/v1/hidden-fields', true); xhr.open('GET', '/ocs/v2.php/apps/minimalprofile/api/v1/hidden-fields', true);
xhr.onload = function() { xhr.onload = function() {
console.log('MinimalProfile v43: Response status', xhr.status, 'body:', xhr.responseText.substring(0, 200));
if (xhr.status === 200) { if (xhr.status === 200) {
try { try {
var data = JSON.parse(xhr.responseText); var data = JSON.parse(xhr.responseText);
console.log('MinimalProfile v42: API returned', data.ocs.data.hiddenFields); var fields = data?.ocs?.data?.hiddenFields;
hideFields(data.ocs.data.hiddenFields); console.log('MinimalProfile v43: API returned', fields);
hideFields(fields);
} catch(e) { } catch(e) {
console.error('MinimalProfile v42: JSON parse error', e); console.error('MinimalProfile v43: JSON parse error', e);
} }
} else { } else {
console.error('MinimalProfile v42: API failed', xhr.status); console.error('MinimalProfile v43: API failed', xhr.status);
} }
}; };
xhr.onerror = function() { xhr.onerror = function() {
console.error('MinimalProfile v42: Network error'); console.error('MinimalProfile v43: Network error');
}; };
xhr.send(); xhr.send();
} }