aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2026-05-29 14:53:47 +0200
committerFlorian Fischer <florian.fischer@muhq.space>2026-05-29 14:53:47 +0200
commit57432354285f2894137c4cc5d80e569410318221 (patch)
tree76b4e8a12b08104914b545f505e76806620b4395
parentad99ac893f672bdea863456fcb413fc1a0a90148 (diff)
downloadbycs-sol-57432354285f2894137c4cc5d80e569410318221.tar.gz
bycs-sol-57432354285f2894137c4cc5d80e569410318221.zip
cockpit: reset the student icon when loading a new one
TODO: prevent reloading of the same student's icon
-rw-r--r--cockpit/js/cockpit.js6
1 files changed, 6 insertions, 0 deletions
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);
}