Merge pull request #6012 from matrix-org/t3chguy/fix/17238
Add feedback mechanism for beta features, namely Spaces
This commit is contained in:
commit
ea9be0dd4c
14 changed files with 318 additions and 17 deletions
|
@ -28,6 +28,7 @@ import * as rageshake from './rageshake';
|
|||
// polyfill textencoder if necessary
|
||||
import * as TextEncodingUtf8 from 'text-encoding-utf-8';
|
||||
import SettingsStore from "../settings/SettingsStore";
|
||||
import SdkConfig from "../SdkConfig";
|
||||
let TextEncoder = window.TextEncoder;
|
||||
if (!TextEncoder) {
|
||||
TextEncoder = TextEncodingUtf8.TextEncoder;
|
||||
|
@ -268,6 +269,25 @@ function uint8ToString(buf: Buffer) {
|
|||
return out;
|
||||
}
|
||||
|
||||
export async function submitFeedback(endpoint: string, label: string, comment: string, canContact = false) {
|
||||
let version = "UNKNOWN";
|
||||
try {
|
||||
version = await PlatformPeg.get().getAppVersion();
|
||||
} catch (err) {} // PlatformPeg already logs this.
|
||||
|
||||
const body = new FormData();
|
||||
body.append("label", label);
|
||||
body.append("text", comment);
|
||||
body.append("can_contact", canContact ? "yes" : "no");
|
||||
|
||||
body.append("app", "element-web");
|
||||
body.append("version", version);
|
||||
body.append("platform", PlatformPeg.get().getHumanReadableName());
|
||||
body.append("user_id", MatrixClientPeg.get()?.getUserId());
|
||||
|
||||
await _submitReport(SdkConfig.get().bug_report_endpoint_url, body, () => {});
|
||||
}
|
||||
|
||||
function _submitReport(endpoint: string, body: FormData, progressCallback: (string) => void) {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
const req = new XMLHttpRequest();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue