asdkjlfhlaskjdhf
This commit is contained in:
@@ -1,50 +1,41 @@
|
||||
// coms/client/public/data.js
|
||||
// Data module: holds the in‐memory threads, notices and reply state
|
||||
|
||||
import { notifyNotice } from "./notifications.js";
|
||||
|
||||
// Map of all messages and notices by ID (string IDs)
|
||||
// Client’s own session ID
|
||||
// Client’s own session ID.
|
||||
let myId = null;
|
||||
|
||||
// Map of all messages and notices by ID (string IDs).
|
||||
const threads = new Map();
|
||||
|
||||
// Map of connected users by unique ID
|
||||
// Map of connected users by unique ID.
|
||||
const users = new Map();
|
||||
|
||||
// Ordered list of root‐level IDs (messages and notices, stored as strings)
|
||||
// Ordered list of root‐level IDs (messages and notices, stored as strings).
|
||||
const rootIds = [];
|
||||
|
||||
// Negative counter to generate unique IDs for notices
|
||||
// Negative counter to generate unique IDs for notices.
|
||||
let noticeCounter = -1;
|
||||
|
||||
// ID of the message we’re currently replying to (string or null)
|
||||
// ID of the message we’re currently replying to (string or null).
|
||||
let replyTo = null;
|
||||
|
||||
// ID of the message currently focused for navigation (string or null)
|
||||
// ID of the message currently focused for navigation (string or null).
|
||||
let focusedId = null;
|
||||
|
||||
/**
|
||||
* Set the focused message ID (or null to clear).
|
||||
* @param {string|null} id
|
||||
*/
|
||||
// Set the focused message ID (or null to clear).
|
||||
function setFocused(id) {
|
||||
focusedId = id;
|
||||
}
|
||||
/**
|
||||
* Get the currently focused message ID.
|
||||
* @returns {string|null}
|
||||
*/
|
||||
|
||||
// Get the currently focused message ID.
|
||||
function getFocused() {
|
||||
return focusedId;
|
||||
}
|
||||
/**
|
||||
* Clear the current focus.
|
||||
*/
|
||||
|
||||
function clearFocused() {
|
||||
focusedId = null;
|
||||
}
|
||||
|
||||
// -- User management API ---
|
||||
// USER MANAGEMENT STUFF.
|
||||
|
||||
/**
|
||||
* Register a user with their unique ID.
|
||||
|
||||
Reference in New Issue
Block a user