Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit b373ef8

Browse files
committed
Merge branch 'develop' into weeman1337/pillify-permalinks
2 parents 1369660 + 2344eaa commit b373ef8

File tree

16 files changed

+84
-63
lines changed

16 files changed

+84
-63
lines changed

cypress/e2e/polls/pollHistory.spec.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,6 @@ describe("Poll history", () => {
8888
cy.startHomeserver("default").then((data) => {
8989
homeserver = data;
9090

91-
cy.enableLabsFeature("feature_poll_history");
92-
9391
cy.initTestUser(homeserver, "Tom");
9492
});
9593
});

src/components/views/dialogs/GenericFeatureFeedbackDialog.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ interface IProps {
2929
title: string;
3030
subheading: string;
3131
rageshakeLabel: string;
32-
rageshakeData?: Record<string, string>;
32+
rageshakeData?: Record<string, any>;
3333
children?: ReactNode;
3434
onFinished(sendFeedback?: boolean): void;
3535
}

src/components/views/dialogs/RoomSettingsDialog.tsx

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -164,16 +164,14 @@ export default class RoomSettingsDialog extends React.Component<IProps, IState>
164164
);
165165
}
166166

167-
if (SettingsStore.getValue("feature_poll_history")) {
168-
tabs.push(
169-
new Tab(
170-
ROOM_POLL_HISTORY_TAB,
171-
_td("Polls history"),
172-
"mx_RoomSettingsDialog_pollsIcon",
173-
<PollHistoryTab roomId={this.props.roomId} onFinished={() => this.props.onFinished(true)} />,
174-
),
175-
);
176-
}
167+
tabs.push(
168+
new Tab(
169+
ROOM_POLL_HISTORY_TAB,
170+
_td("Polls history"),
171+
"mx_RoomSettingsDialog_pollsIcon",
172+
<PollHistoryTab roomId={this.props.roomId} onFinished={() => this.props.onFinished(true)} />,
173+
),
174+
);
177175

178176
if (SettingsStore.getValue(UIFeature.AdvancedSettings)) {
179177
tabs.push(

src/components/views/right_panel/RoomSummaryCard.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -327,8 +327,6 @@ const RoomSummaryCard: React.FC<IProps> = ({ room, permalinkCreator, onClose })
327327
const pinningEnabled = useFeatureEnabled("feature_pinning");
328328
const pinCount = usePinnedEvents(pinningEnabled ? room : undefined)?.length;
329329

330-
const isPollHistoryEnabled = useFeatureEnabled("feature_poll_history");
331-
332330
return (
333331
<BaseCard header={header} className="mx_RoomSummaryCard" onClose={onClose}>
334332
<Group title={_t("About")} className="mx_RoomSummaryCard_aboutGroup">
@@ -341,7 +339,7 @@ const RoomSummaryCard: React.FC<IProps> = ({ room, permalinkCreator, onClose })
341339
{_t("Files")}
342340
</Button>
343341
)}
344-
{!isVideoRoom && isPollHistoryEnabled && (
342+
{!isVideoRoom && (
345343
<Button className="mx_RoomSummaryCard_icon_poll" onClick={onRoomPollHistoryClick}>
346344
{_t("Polls history")}
347345
</Button>

src/components/views/spaces/SpaceCreateMenu.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ export const SpaceFeedbackPrompt: React.FC<{
140140
rageshakeData: Object.fromEntries(
141141
["Spaces.allRoomsInHome", "Spaces.enabledMetaSpaces"].map((k) => [
142142
k,
143-
String(SettingsStore.getValue(k)),
143+
SettingsStore.getValue(k),
144144
]),
145145
),
146146
});

src/i18n/strings/en_EN.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -960,8 +960,6 @@
960960
"Use new room breadcrumbs": "Use new room breadcrumbs",
961961
"Right panel stays open": "Right panel stays open",
962962
"Defaults to room member list.": "Defaults to room member list.",
963-
"Polls history": "Polls history",
964-
"View a list of polls in a room. (Under active development)": "View a list of polls in a room. (Under active development)",
965963
"Jump to date (adds /jumptodate and jump to date headers)": "Jump to date (adds /jumptodate and jump to date headers)",
966964
"Requires your server to support MSC3030": "Requires your server to support MSC3030",
967965
"Send read receipts": "Send read receipts",
@@ -2236,6 +2234,7 @@
22362234
"Not encrypted": "Not encrypted",
22372235
"About": "About",
22382236
"Files": "Files",
2237+
"Polls history": "Polls history",
22392238
"Pinned": "Pinned",
22402239
"Export chat": "Export chat",
22412240
"Share room": "Share room",

src/rageshake/rageshake.ts

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,17 @@ export class ConsoleLogger {
6464
warn: "W",
6565
error: "E",
6666
} as const;
67-
Object.keys(consoleFunctionsToLevels).forEach((fnName: keyof typeof consoleFunctionsToLevels) => {
68-
const level = consoleFunctionsToLevels[fnName];
69-
const originalFn = consoleObj[fnName].bind(consoleObj);
70-
this.originalFunctions[fnName] = originalFn;
71-
consoleObj[fnName] = (...args) => {
72-
this.log(level, ...args);
73-
originalFn(...args);
74-
};
75-
});
67+
(Object.keys(consoleFunctionsToLevels) as [keyof typeof consoleFunctionsToLevels]).forEach(
68+
(fnName: keyof typeof consoleFunctionsToLevels) => {
69+
const level = consoleFunctionsToLevels[fnName];
70+
const originalFn = consoleObj[fnName].bind(consoleObj);
71+
this.originalFunctions[fnName] = originalFn;
72+
consoleObj[fnName] = (...args) => {
73+
this.log(level, ...args);
74+
originalFn(...args);
75+
};
76+
},
77+
);
7678
}
7779

7880
public bypassRageshake(fnName: LogFunctionName, ...args: (Error | DOMException | object | string)[]): void {
@@ -261,6 +263,8 @@ export class IndexedDBLogStore {
261263
// Returns: a string representing the concatenated logs for this ID.
262264
// Stops adding log fragments when the size exceeds maxSize
263265
function fetchLogs(id: string, maxSize: number): Promise<string> {
266+
if (!db) return Promise.reject("DB unavailable");
267+
264268
const objectStore = db.transaction("logs", "readonly").objectStore("logs");
265269

266270
return new Promise((resolve, reject) => {
@@ -287,6 +291,8 @@ export class IndexedDBLogStore {
287291

288292
// Returns: A sorted array of log IDs. (newest first)
289293
function fetchLogIds(): Promise<string[]> {
294+
if (!db) return Promise.reject("DB unavailable");
295+
290296
// To gather all the log IDs, query for all records in logslastmod.
291297
const o = db.transaction("logslastmod", "readonly").objectStore("logslastmod");
292298
return selectQuery(o, undefined, (cursor) => {
@@ -305,6 +311,8 @@ export class IndexedDBLogStore {
305311
}
306312

307313
function deleteLogs(id: string): Promise<void> {
314+
if (!db) return Promise.reject("DB unavailable");
315+
308316
return new Promise<void>((resolve, reject) => {
309317
const txn = db.transaction(["logs", "logslastmod"], "readwrite");
310318
const o = txn.objectStore("logs");

src/rageshake/submit-rageshake.ts

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ async function collectBugReport(opts: IOpts = {}, gzipLogs = true): Promise<Form
8888
keys.push(`curve25519:${client.getDeviceCurve25519Key()}`);
8989
}
9090
body.append("device_keys", keys.join(", "));
91-
body.append("cross_signing_key", client.getCrossSigningId());
91+
body.append("cross_signing_key", client.getCrossSigningId() ?? "n/a");
9292

9393
// add cross-signing status information
9494
const crossSigning = client.crypto.crossSigningInfo;
@@ -99,7 +99,7 @@ async function collectBugReport(opts: IOpts = {}, gzipLogs = true): Promise<Form
9999
"cross_signing_supported_by_hs",
100100
String(await client.doesServerSupportUnstableFeature("org.matrix.e2e_cross_signing")),
101101
);
102-
body.append("cross_signing_key", crossSigning.getId());
102+
body.append("cross_signing_key", crossSigning.getId() ?? "n/a");
103103
body.append(
104104
"cross_signing_privkey_in_secret_storage",
105105
String(!!(await crossSigning.isStoredInSecretStorage(secretStorage))),
@@ -108,15 +108,15 @@ async function collectBugReport(opts: IOpts = {}, gzipLogs = true): Promise<Form
108108
const pkCache = client.getCrossSigningCacheCallbacks();
109109
body.append(
110110
"cross_signing_master_privkey_cached",
111-
String(!!(pkCache && (await pkCache.getCrossSigningKeyCache("master")))),
111+
String(!!(pkCache && (await pkCache?.getCrossSigningKeyCache?.("master")))),
112112
);
113113
body.append(
114114
"cross_signing_self_signing_privkey_cached",
115-
String(!!(pkCache && (await pkCache.getCrossSigningKeyCache("self_signing")))),
115+
String(!!(pkCache && (await pkCache?.getCrossSigningKeyCache?.("self_signing")))),
116116
);
117117
body.append(
118118
"cross_signing_user_signing_privkey_cached",
119-
String(!!(pkCache && (await pkCache.getCrossSigningKeyCache("user_signing")))),
119+
String(!!(pkCache && (await pkCache?.getCrossSigningKeyCache?.("user_signing")))),
120120
);
121121

122122
body.append("secret_storage_ready", String(await client.isSecretStorageReady()));
@@ -163,14 +163,14 @@ async function collectBugReport(opts: IOpts = {}, gzipLogs = true): Promise<Form
163163
body.append("storageManager_usage", String(estimate.usage));
164164
if (estimate.usageDetails) {
165165
Object.keys(estimate.usageDetails).forEach((k) => {
166-
body.append(`storageManager_usage_${k}`, String(estimate.usageDetails[k]));
166+
body.append(`storageManager_usage_${k}`, String(estimate.usageDetails![k]));
167167
});
168168
}
169169
} catch (e) {}
170170
}
171171

172172
if (window.Modernizr) {
173-
const missingFeatures = Object.keys(window.Modernizr).filter(
173+
const missingFeatures = (Object.keys(window.Modernizr) as [keyof ModernizrStatic]).filter(
174174
(key: keyof ModernizrStatic) => window.Modernizr[key] === false,
175175
);
176176
if (missingFeatures.length > 0) {
@@ -253,7 +253,7 @@ export async function downloadBugReport(opts: IOpts = {}): Promise<void> {
253253
await new Promise<void>((resolve) => {
254254
const reader = new FileReader();
255255
reader.addEventListener("loadend", (ev) => {
256-
tape.append(`log-${i++}.log`, new TextDecoder().decode(ev.target.result as ArrayBuffer));
256+
tape.append(`log-${i++}.log`, new TextDecoder().decode(reader.result as ArrayBuffer));
257257
resolve();
258258
});
259259
reader.readAsArrayBuffer(value as Blob);
@@ -288,7 +288,7 @@ export async function submitFeedback(
288288
label: string,
289289
comment: string,
290290
canContact = false,
291-
extraData: Record<string, string> = {},
291+
extraData: Record<string, any> = {},
292292
): Promise<void> {
293293
let version: string | undefined;
294294
try {
@@ -302,14 +302,18 @@ export async function submitFeedback(
302302

303303
body.append("app", "element-web");
304304
body.append("version", version || "UNKNOWN");
305-
body.append("platform", PlatformPeg.get().getHumanReadableName());
306-
body.append("user_id", MatrixClientPeg.get()?.getUserId());
305+
body.append("platform", PlatformPeg.get()?.getHumanReadableName() ?? "n/a");
306+
body.append("user_id", MatrixClientPeg.get()?.getUserId() ?? "n/a");
307307

308308
for (const k in extraData) {
309309
body.append(k, JSON.stringify(extraData[k]));
310310
}
311311

312-
await submitReport(SdkConfig.get().bug_report_endpoint_url, body, () => {});
312+
const bugReportEndpointUrl = SdkConfig.get().bug_report_endpoint_url;
313+
314+
if (bugReportEndpointUrl) {
315+
await submitReport(bugReportEndpointUrl, body, () => {});
316+
}
313317
}
314318

315319
function submitReport(endpoint: string, body: FormData, progressCallback: (str: string) => void): Promise<string> {

src/resizer/distributors/collapse.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import Sizer from "../sizer";
2121

2222
export interface ICollapseConfig extends IConfig {
2323
toggleSize: number;
24-
onCollapsed?(collapsed: boolean, id: string, element: HTMLElement): void;
24+
onCollapsed?(collapsed: boolean, id: string | null, element: HTMLElement): void;
2525
isItemCollapsed(element: HTMLElement): boolean;
2626
}
2727

@@ -45,7 +45,7 @@ export default class CollapseDistributor extends FixedDistributor<ICollapseConfi
4545
return new CollapseItem(resizeHandle, resizer, sizer, container);
4646
}
4747

48-
private readonly toggleSize: number;
48+
private readonly toggleSize: number | undefined;
4949
private isCollapsed: boolean;
5050

5151
public constructor(item: CollapseItem) {
@@ -55,7 +55,7 @@ export default class CollapseDistributor extends FixedDistributor<ICollapseConfi
5555
}
5656

5757
public resize(newSize: number): void {
58-
const isCollapsedSize = newSize < this.toggleSize;
58+
const isCollapsedSize = !!this.toggleSize && newSize < this.toggleSize;
5959
if (isCollapsedSize !== this.isCollapsed) {
6060
this.isCollapsed = isCollapsedSize;
6161
this.item.notifyCollapsed(isCollapsedSize);

src/resizer/distributors/percentage.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ import { IConfig } from "../resizer";
2121
class PercentageSizer extends Sizer {
2222
public start(item: HTMLElement): void {
2323
if (this.vertical) {
24-
item.style.minHeight = null;
24+
item.style.minHeight = "";
2525
} else {
26-
item.style.minWidth = null;
26+
item.style.minWidth = "";
2727
}
2828
}
2929

0 commit comments

Comments
 (0)