Return error for undefined accounts

This commit is contained in:
nachtjasmin 2023-07-22 13:13:02 +02:00 committed by Jasmin
parent 43adaf4a61
commit 4720af6c58

View file

@ -6,7 +6,7 @@ import { hasClasses } from "./domhelpers";
* @returns {string}
*/
export function normaliseAccountName(name) {
if (!name) return "null";
if (!name) throw new Error("null/undefined passed to normaliseAccountName");
if (name[0] == "@") name = name.substring(1);
// if the username doesn't contain an @ (i.e. the post we're looking at is from this instance)
// append the host name to it, to avoid cache overlap between instances