mirror of
https://github.com/element-hq/element-web.git
synced 2024-12-18 07:12:58 +03:00
Merge pull request #27881 from element-hq/t3chguy/make-sonar-happier
Make sonarcloud happier
This commit is contained in:
commit
1424314f12
4 changed files with 6 additions and 6 deletions
|
@ -101,7 +101,7 @@ export default class Favicon {
|
||||||
h: number;
|
h: number;
|
||||||
} {
|
} {
|
||||||
const opt = {
|
const opt = {
|
||||||
n: typeof n === "number" ? Math.abs(n as number | 0) : n,
|
n: typeof n === "number" ? Math.abs(n | 0) : n,
|
||||||
len: ("" + n).length,
|
len: ("" + n).length,
|
||||||
// badge positioning constants as percentages
|
// badge positioning constants as percentages
|
||||||
x: 0.4,
|
x: 0.4,
|
||||||
|
@ -178,7 +178,7 @@ export default class Favicon {
|
||||||
this.context.fillStyle = params.textColor;
|
this.context.fillStyle = params.textColor;
|
||||||
|
|
||||||
if (typeof opt.n === "number" && opt.n > 999) {
|
if (typeof opt.n === "number" && opt.n > 999) {
|
||||||
const count = (opt.n > 9999 ? 9 : Math.floor((opt.n as number) / 1000)) + "k+";
|
const count = (opt.n > 9999 ? 9 : Math.floor(opt.n / 1000)) + "k+";
|
||||||
this.context.fillText(count, Math.floor(opt.x + opt.w / 2), Math.floor(opt.y + opt.h - opt.h * 0.2));
|
this.context.fillText(count, Math.floor(opt.x + opt.w / 2), Math.floor(opt.y + opt.h - opt.h * 0.2));
|
||||||
} else {
|
} else {
|
||||||
this.context.fillText("" + opt.n, Math.floor(opt.x + opt.w / 2), Math.floor(opt.y + opt.h - opt.h * 0.15));
|
this.context.fillText("" + opt.n, Math.floor(opt.x + opt.w / 2), Math.floor(opt.y + opt.h - opt.h * 0.15));
|
||||||
|
|
|
@ -23,7 +23,7 @@ export async function getVectorConfig(relativeLocation = ""): Promise<IConfigOpt
|
||||||
|
|
||||||
// Handle trailing dot FQDNs
|
// Handle trailing dot FQDNs
|
||||||
let domain = window.location.hostname.trimEnd();
|
let domain = window.location.hostname.trimEnd();
|
||||||
if (domain[domain.length - 1] === ".") {
|
if (domain.endsWith(".")) {
|
||||||
domain = domain.slice(0, -1);
|
domain = domain.slice(0, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
if (window.localStorage) {
|
if (window.localStorage) {
|
||||||
Object.keys(window.localStorage).forEach((key) => {
|
Object.keys(window.localStorage).forEach((key) => {
|
||||||
if (key.indexOf("loglevel:") === 0) {
|
if (key.startsWith("loglevel:")) {
|
||||||
window.localStorage.removeItem(key);
|
window.localStorage.removeItem(key);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -70,7 +70,7 @@ async function initPage(): Promise<void> {
|
||||||
try {
|
try {
|
||||||
const result = await fetch(`https://${serverName}/.well-known/matrix/client`);
|
const result = await fetch(`https://${serverName}/.well-known/matrix/client`);
|
||||||
const wkConfig = await result.json();
|
const wkConfig = await result.json();
|
||||||
if (wkConfig && wkConfig["m.homeserver"]) {
|
if (wkConfig?.["m.homeserver"]) {
|
||||||
hsUrl = wkConfig["m.homeserver"]["base_url"];
|
hsUrl = wkConfig["m.homeserver"]["base_url"];
|
||||||
|
|
||||||
if (wkConfig["m.identity_server"]) {
|
if (wkConfig["m.identity_server"]) {
|
||||||
|
@ -78,7 +78,7 @@ async function initPage(): Promise<void> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (wkConfig && wkConfig["m.homeserver"]) {
|
if (wkConfig?.["m.homeserver"]) {
|
||||||
hsUrl = wkConfig["m.homeserver"]["base_url"] || undefined;
|
hsUrl = wkConfig["m.homeserver"]["base_url"] || undefined;
|
||||||
|
|
||||||
if (wkConfig["m.identity_server"]) {
|
if (wkConfig["m.identity_server"]) {
|
||||||
|
|
Loading…
Reference in a new issue