Fix `DisabledComposerView` description being overriden by powerlevel changes (#58)
We added the description in https://github.com/matrix-org/matrix-public-archive/pull/54 but then made a fix to one of the after render errors, https://github.com/matrix-org/matrix-public-archive/pull/57, which exposed that the description is then overriden when the powerlevel changes. We now just override the getters directly instead of the internal fields which are overwritten internally. --- This also fixes a warning from Hydrogen in the console: ``` disposable not found, did it leak? {kind: 'disabled', description: Array(3)} ```
This commit is contained in:
parent
33d52e8c07
commit
fd00fec6f1
|
@ -262,25 +262,32 @@ async function mountHydrogen() {
|
||||||
this.navigation.applyPath(path);
|
this.navigation.applyPath(path);
|
||||||
};
|
};
|
||||||
|
|
||||||
// FIXME: We shouldn't have to dive into the internal fields to make this work
|
Object.defineProperty(roomViewModel, 'timelineViewModel', {
|
||||||
roomViewModel._timelineVM = timelineViewModel;
|
get() {
|
||||||
|
return timelineViewModel;
|
||||||
|
},
|
||||||
|
});
|
||||||
const fromDate = new Date(fromTimestamp);
|
const fromDate = new Date(fromTimestamp);
|
||||||
const dateString = fromDate.toISOString().split('T')[0];
|
const dateString = fromDate.toISOString().split('T')[0];
|
||||||
roomViewModel._composerVM = {
|
Object.defineProperty(roomViewModel, 'composerViewModel', {
|
||||||
kind: 'disabled',
|
get() {
|
||||||
description: [
|
return {
|
||||||
`You're viewing an archive of events from ${dateString}. Use a `,
|
kind: 'disabled',
|
||||||
tag.a(
|
description: [
|
||||||
{
|
`You're viewing an archive of events from ${dateString}. Use a `,
|
||||||
href: matrixPublicArchiveURLCreator.permalinkForRoomId(roomData.id),
|
tag.a(
|
||||||
rel: 'noopener',
|
{
|
||||||
target: '_blank',
|
href: matrixPublicArchiveURLCreator.permalinkForRoomId(roomData.id),
|
||||||
},
|
rel: 'noopener',
|
||||||
['Matrix client']
|
target: '_blank',
|
||||||
),
|
},
|
||||||
` to start chatting in this room.`,
|
['Matrix client']
|
||||||
],
|
),
|
||||||
};
|
` to start chatting in this room.`,
|
||||||
|
],
|
||||||
|
};
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
const archiveViewModel = new ArchiveViewModel({
|
const archiveViewModel = new ArchiveViewModel({
|
||||||
// Hydrogen options
|
// Hydrogen options
|
||||||
|
|
Loading…
Reference in New Issue