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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user