Merge branch 'develop' into dbkr/jitsi_display_name

This commit is contained in:
David Baker 2021-03-17 19:17:52 +00:00 committed by GitHub
commit d95955d90b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
75 changed files with 989 additions and 540 deletions

View file

@ -22,6 +22,7 @@ import { User } from "matrix-js-sdk/src/models/user";
import { throttle } from "lodash";
import { MatrixClientPeg } from "../MatrixClientPeg";
import { _t } from "../languageHandler";
import {mediaFromMxc} from "../customisations/Media";
interface IState {
displayName?: string;
@ -81,12 +82,13 @@ export class OwnProfileStore extends AsyncStoreWithClient<IState> {
*/
public getHttpAvatarUrl(size = 0): string {
if (!this.avatarMxc) return null;
const adjustedSize = size > 1 ? size : undefined; // don't let negatives or zero through
// XXX: We use MatrixClientPeg here rather than this.matrixClient because otherwise we'll
// race because our data stores aren't set up consistently enough that this will all be
// initialised with a store before these getter methods are called.
return MatrixClientPeg.get().mxcUrlToHttp(this.avatarMxc, adjustedSize, adjustedSize);
const media = mediaFromMxc(this.avatarMxc);
if (!size || size <= 0) {
return media.srcHttp;
} else {
return media.getSquareThumbnailHttp(size);
}
}
protected async onNotReady() {