Conform more code to strict null checking (#10153)

* Conform more code to strict null checking

* Conform more code to strict null checking

* Iterate

* Iterate
This commit is contained in:
Michael Telatynski 2023-02-15 13:36:22 +00:00 committed by GitHub
parent a4ff959aa1
commit 145a5a8a8d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
89 changed files with 520 additions and 551 deletions

View file

@ -81,8 +81,8 @@ async function collectBugReport(opts: IOpts = {}, gzipLogs = true): Promise<Form
}
if (client) {
body.append("user_id", client.credentials.userId);
body.append("device_id", client.deviceId);
body.append("user_id", client.credentials.userId!);
body.append("device_id", client.deviceId!);
// TODO: make this work with rust crypto
if (client.isCryptoEnabled() && client.crypto) {
@ -181,7 +181,7 @@ async function collectBugReport(opts: IOpts = {}, gzipLogs = true): Promise<Form
}
}
body.append("mx_local_settings", localStorage.getItem("mx_local_settings"));
body.append("mx_local_settings", localStorage.getItem("mx_local_settings")!);
if (opts.sendLogs) {
progressCallback(_t("Collecting logs"));
@ -293,9 +293,9 @@ export async function submitFeedback(
canContact = false,
extraData: Record<string, string> = {},
): Promise<void> {
let version = "UNKNOWN";
let version: string | undefined;
try {
version = await PlatformPeg.get().getAppVersion();
version = await PlatformPeg.get()?.getAppVersion();
} catch (err) {} // PlatformPeg already logs this.
const body = new FormData();
@ -304,7 +304,7 @@ export async function submitFeedback(
body.append("can_contact", canContact ? "yes" : "no");
body.append("app", "element-web");
body.append("version", version);
body.append("version", version || "UNKNOWN");
body.append("platform", PlatformPeg.get().getHumanReadableName());
body.append("user_id", MatrixClientPeg.get()?.getUserId());