Add an admin account

This commit is contained in:
2025-08-25 11:20:04 +03:00
Unverified
parent cfaaad9b57
commit b8a7c20f96
5 changed files with 62 additions and 12 deletions
+6 -8
View File
@@ -78,17 +78,15 @@ function bindEvents(): void {
export function show(message: Message, x: number, y: number): void {
currentMessage = message;
// Only show edit and delete for own messages
// Show delete for own messages and for owner on any message
const editItem = menu.querySelector('[data-action="edit"]') as HTMLElement;
const deleteItem = menu.querySelector('[data-action="delete"]') as HTMLElement;
if (message.username === currentUser?.username) {
editItem.style.display = 'flex';
deleteItem.style.display = 'flex';
} else {
editItem.style.display = 'none';
deleteItem.style.display = 'none';
}
const isAuthor = message.username === currentUser?.username;
const isOwner = !!currentUser?.admin;
editItem.style.display = isAuthor ? 'flex' : 'none';
deleteItem.style.display = (isAuthor || isOwner) ? 'flex' : 'none';
// Position the menu properly
menu.style.display = 'block';
+1
View File
@@ -81,6 +81,7 @@ export interface User {
last_seen: string;
online: boolean;
username: string;
admin?: boolean;
bio?: string;
}