From 57432354285f2894137c4cc5d80e569410318221 Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Fri, 29 May 2026 14:53:47 +0200 Subject: cockpit: reset the student icon when loading a new one TODO: prevent reloading of the same student's icon --- cockpit/js/cockpit.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cockpit/js/cockpit.js b/cockpit/js/cockpit.js index e2f07b2..de0f3ed 100644 --- a/cockpit/js/cockpit.js +++ b/cockpit/js/cockpit.js @@ -195,7 +195,12 @@ async function fetchAndUpdateStudentInfo() { updateStudentInfo(); } +let DEFAULT_STUDENT_ICON; + function updateStudentInfo() { + // Reset the student icon + document.getElementById("student-info-icon").src = DEFAULT_STUDENT_ICON; + // Try to replace the generic icon with the user's icon var img = document.createElement('img'); img.onload = function() { @@ -288,6 +293,7 @@ async function initCockpit() { window.onload = function() { isTeacher = getIsTeacher(); + DEFAULT_STUDENT_ICON = document.getElementById("student-info-icon").src; initCurrentName(); initCockpit(isTeacher); } -- cgit v1.2.3