// How a deleted account's name is shown (ACCOUNT_DELETION.md AD5, AD6). // // The server decides WHAT name a viewer gets (server/src/utils/displayAuthor.js): // a member is sent "[deleted player]", staff are sent the stored name and a // `…Deleted` flag. All this file does is mark the staff case, so a moderator // reading "Ravenna" knows that account no longer exists. export const DELETED_PLAYER = '[deleted player]' /** "Ravenna (deleted account)" for staff; the placeholder is left as it is. */ export function markDeleted(name, deleted) { if (!name) return name return deleted && name !== DELETED_PLAYER ? `${name} (deleted account)` : name } /** * The same for an admin view that is handed raw ledger rows (`actor_user_id`, * `actor_username`): an id that is NULL beside a snapshot that is not is a * deleted account, and nothing else clears those ids. Only an explicit null * counts — a row that does not carry the id column at all says nothing. */ export function rowName(userId, username, fallback = '—') { if (!username) return fallback return markDeleted(username, userId === null) }