fix: glassmorphism sidebar background visibility + image upload cleanup

Glassmorphism: the sidebar is a flex sibling of the room view, so
backdrop-filter had nothing behind it to blur. Fix: apply the active
chat background to document.body when glassmorphismSidebar is on
(cleaned up when it's turned off or the component unmounts). Now the
sidebar blurs through the same background pattern as the room view,
making the frosted-glass effect obvious.

Image upload cleanup: delete the pre-uploaded original MXC from the
homeserver after the compressed version is successfully uploaded
(Synapse 1.97+ DELETE /_matrix/client/v1/media/{server}/{mediaId}).
Also delete on cancel when a successful upload is removed by the user.
Both are best-effort — failures are swallowed so UX is unaffected.
Added tryDeleteMxcContent() utility to src/app/utils/matrix.ts.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-05 11:25:19 -04:00
parent 5d525d4246
commit 8ac63e3771
4 changed files with 58 additions and 1 deletions
+17
View File
@@ -401,3 +401,20 @@ export const creatorsSupported = (version: string): boolean => {
const unsupportedVersion = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11'];
return !unsupportedVersion.includes(version);
};
// Best-effort deletion of a user-owned MXC URI from the homeserver.
// Synapse 1.97+ supports DELETE /_matrix/client/v1/media/{server}/{mediaId} for media owners.
// Failures are silently ignored — this is cleanup only, not critical path.
export const tryDeleteMxcContent = async (mx: MatrixClient, mxcUrl: string): Promise<void> => {
try {
const path = mxcUrl.replace('mxc://', '');
const token = mx.getAccessToken();
if (!token || !path.includes('/')) return;
await fetch(`${mx.getHomeserverUrl()}/_matrix/client/v1/media/${path}`, {
method: 'DELETE',
headers: { Authorization: `Bearer ${token}` },
});
} catch {
// Intentionally swallowed
}
};