Add test dm accepting, revoking and declining
This commit is contained in:
parent
81e222250d
commit
2979881908
3 changed files with 41 additions and 16 deletions
|
|
@ -94,7 +94,9 @@
|
|||
{
|
||||
await updateProtocolAndUrl(window.location.hostname);
|
||||
}
|
||||
sidebarPfp.src = await getAvatarUrl(`${username}:${host}`);
|
||||
let localIdRes = await fetchAsync(`${url}/nametoid?u=${username}`);
|
||||
let localId = localIdRes.trim();
|
||||
sidebarPfp.src = await getAvatarUrl(localId, `${username}:${host}`);
|
||||
|
||||
showAction("action.auth", "startauth");
|
||||
let res = await Auth(username, password);
|
||||
|
|
@ -134,7 +136,15 @@
|
|||
async function addDm() {
|
||||
try {
|
||||
showAction("action.dm.adding", "dmadd");
|
||||
let res = await fetchEncrypted("user/dm/invite", document.getElementById("addchat-username").value);
|
||||
let username = document.getElementById("addchat-username").value;
|
||||
let idRes = await fetchAsync(`${url}/nametoid?u=${username}`);
|
||||
if (idRes.startsWith("error") || idRes.trim() === "0" || idRes.trim() === "") {
|
||||
clearAction("dmadd");
|
||||
showBlahNotification("error:user.not.found");
|
||||
return;
|
||||
}
|
||||
let targetId = idRes.trim();
|
||||
let res = await fetchEncrypted("user/dm/invite", targetId);
|
||||
|
||||
clearAction("dmadd");
|
||||
showBlahNotification(res);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue