invites: add /invites/send, store more details in new SentTo field

deprecated SendTo string field for SentTo, which holds successful send
addresses, and failures with a reason that isn't plain text. Will soon
add an interface for sending invites after their creation. For #444
(ha).
This commit is contained in:
Harvey Tindall
2025-12-05 12:03:21 +00:00
parent 3635a13682
commit 5fa528fd2d
19 changed files with 327 additions and 144 deletions
+10
View File
@@ -1,4 +1,5 @@
import { _get } from "../modules/common.js";
import { Template } from "@hrfee/simpletemplate";
interface Meta {
name: string;
@@ -39,6 +40,15 @@ export class lang implements Lang {
return str;
}
template = (sect: string, key: string, subs: { [key: string]: any }): string => {
if (sect == "quantityStrings" || sect == "meta") { return ""; }
const map = new Map<string, any>();
for (let key of Object.keys(subs)) { map.set(key, subs[key]); }
const [out, err] = Template(this._lang[sect][key], map);
if (err != null) throw err;
return out;
}
quantity = (key: string, number: number): string => {
if (number == 1) {
return this._lang.quantityStrings[key].singular.replace("{n}", ""+number)