Update static/js/04-main.js
This commit is contained in:
parent
ca7eae57d2
commit
09a7dd353d
@ -2,6 +2,31 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
window.Glow = window.Glow || {};
|
window.Glow = window.Glow || {};
|
||||||
|
|
||||||
|
Glow.presenceModeLabel = mode => {
|
||||||
|
switch (String(mode || "").toLowerCase()) {
|
||||||
|
case "silent":
|
||||||
|
return "silent";
|
||||||
|
case "focus":
|
||||||
|
return "focus";
|
||||||
|
case "dnd":
|
||||||
|
return "do not disturb";
|
||||||
|
default:
|
||||||
|
return "online";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const originalUpdateAuthUI = Glow.updateAuthUI;
|
||||||
|
Glow.updateAuthUI = () => {
|
||||||
|
if (typeof originalUpdateAuthUI === "function") {
|
||||||
|
originalUpdateAuthUI();
|
||||||
|
}
|
||||||
|
const user = Glow.state.currentUser;
|
||||||
|
if (user && Glow.els.headerAccount) {
|
||||||
|
const mode = Glow.presenceModeLabel(user.presence_mode);
|
||||||
|
Glow.els.headerAccount.textContent = `${user.username} · ${user.role} · ${mode}`;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
Glow.loadRooms = async () => {
|
Glow.loadRooms = async () => {
|
||||||
const previousSlug = Glow.state.activeRoom?.slug;
|
const previousSlug = Glow.state.activeRoom?.slug;
|
||||||
const data = await Glow.apiRequest("/api/rooms");
|
const data = await Glow.apiRequest("/api/rooms");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user