Skip to content

Commit

Permalink
Update more code
Browse files Browse the repository at this point in the history
  • Loading branch information
estellecomment committed Apr 9, 2024
1 parent 07f4fe7 commit a9d226b
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/tchap/util/TchapUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,9 @@ export default class TchapUtils {
* @returns true is a map tile server is present in config or wellknown.
*/
static isMapConfigured(): boolean {
const cli = MatrixClientPeg.get();
try {
findMapStyleUrl();
findMapStyleUrl(cli);
return true;
} catch (e) {
return false;
Expand Down Expand Up @@ -189,6 +190,8 @@ export default class TchapUtils {
const k = keys[i];
url += k + "=" + encodeURIComponent(params[k]);
}
// todo(estelle) : write unit test, then try replacing by :
// url += "?" + new URLSearchParams(params).toString();
return url;
}

Expand All @@ -197,9 +200,10 @@ export default class TchapUtils {
* @returns true if the mail was sent succesfully, false otherwise
*/
static async requestNewExpiredAccountEmail(): Promise<boolean> {
console.log(":tchap: Requesting an email to renew to account");
const homeserverUrl = MatrixClientPeg.get().getHomeserverUrl();
const accessToken = MatrixClientPeg.get().getAccessToken();
console.debug(":tchap: Requesting an email to renew to account"); // todo(estelle) reuse logger class
const client = MatrixClientPeg.get(); // todo(estelle) what to do if client is null ? use safeGet or get ?
const homeserverUrl = client.getHomeserverUrl();
const accessToken = client.getAccessToken();
//const url = `${homeserverUrl}/_matrix/client/unstable/account_validity/send_mail`;
const url = `${homeserverUrl}${TchapApi.accountValidityResendEmailUrl}`;
const options = {
Expand Down

0 comments on commit a9d226b

Please sign in to comment.