Add `Copy permalink` option to messages (`matrix.to`) (#136)
This might be a little ambiguous since we'll have permalinks within the Matrix Public Archive with `?at=$xxx` (related https://github.com/matrix-org/matrix-public-archive/issues/137) which is different from `matrix.to` permalinks 🤔 But will just go with it for now ⏩
This commit is contained in:
parent
11cbf39460
commit
b41d15a92c
|
@ -21,7 +21,7 @@
|
||||||
"@opentelemetry/semantic-conventions": "^1.3.1",
|
"@opentelemetry/semantic-conventions": "^1.3.1",
|
||||||
"dompurify": "^2.3.9",
|
"dompurify": "^2.3.9",
|
||||||
"express": "^4.17.2",
|
"express": "^4.17.2",
|
||||||
"hydrogen-view-sdk": "npm:@mlm/hydrogen-view-sdk@^0.24.0-scratch",
|
"hydrogen-view-sdk": "npm:@mlm/hydrogen-view-sdk@^0.25.0-scratch",
|
||||||
"json5": "^2.2.1",
|
"json5": "^2.2.1",
|
||||||
"linkedom": "^0.14.17",
|
"linkedom": "^0.14.17",
|
||||||
"matrix-public-archive-shared": "file:./shared/",
|
"matrix-public-archive-shared": "file:./shared/",
|
||||||
|
@ -3640,9 +3640,9 @@
|
||||||
},
|
},
|
||||||
"node_modules/hydrogen-view-sdk": {
|
"node_modules/hydrogen-view-sdk": {
|
||||||
"name": "@mlm/hydrogen-view-sdk",
|
"name": "@mlm/hydrogen-view-sdk",
|
||||||
"version": "0.24.0-scratch",
|
"version": "0.25.0-scratch",
|
||||||
"resolved": "https://registry.npmjs.org/@mlm/hydrogen-view-sdk/-/hydrogen-view-sdk-0.24.0-scratch.tgz",
|
"resolved": "https://registry.npmjs.org/@mlm/hydrogen-view-sdk/-/hydrogen-view-sdk-0.25.0-scratch.tgz",
|
||||||
"integrity": "sha512-NRH2TTjAaV+8siT6R4vAGJ55fSXT/7w5AdTe+mA6fyyTRKX2esWYFO+TtDSABm4TJmySqUxlUP/Yj+h1kuZ46w==",
|
"integrity": "sha512-FgSBCgNbVe/jiy6khdY8ZtbcZ/CRPc1cDPNZM0skUWTnuXzDtzPUQ2dW45yOO951gd+GS01TPhpibjowEOWrow==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@matrix-org/olm": "https://gitlab.matrix.org/api/v4/projects/27/packages/npm/@matrix-org/olm/-/@matrix-org/olm-3.2.8.tgz",
|
"@matrix-org/olm": "https://gitlab.matrix.org/api/v4/projects/27/packages/npm/@matrix-org/olm/-/@matrix-org/olm-3.2.8.tgz",
|
||||||
"another-json": "^0.2.0",
|
"another-json": "^0.2.0",
|
||||||
|
@ -8091,9 +8091,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"hydrogen-view-sdk": {
|
"hydrogen-view-sdk": {
|
||||||
"version": "npm:@mlm/hydrogen-view-sdk@0.24.0-scratch",
|
"version": "npm:@mlm/hydrogen-view-sdk@0.25.0-scratch",
|
||||||
"resolved": "https://registry.npmjs.org/@mlm/hydrogen-view-sdk/-/hydrogen-view-sdk-0.24.0-scratch.tgz",
|
"resolved": "https://registry.npmjs.org/@mlm/hydrogen-view-sdk/-/hydrogen-view-sdk-0.25.0-scratch.tgz",
|
||||||
"integrity": "sha512-NRH2TTjAaV+8siT6R4vAGJ55fSXT/7w5AdTe+mA6fyyTRKX2esWYFO+TtDSABm4TJmySqUxlUP/Yj+h1kuZ46w==",
|
"integrity": "sha512-FgSBCgNbVe/jiy6khdY8ZtbcZ/CRPc1cDPNZM0skUWTnuXzDtzPUQ2dW45yOO951gd+GS01TPhpibjowEOWrow==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@matrix-org/olm": "https://gitlab.matrix.org/api/v4/projects/27/packages/npm/@matrix-org/olm/-/@matrix-org/olm-3.2.8.tgz",
|
"@matrix-org/olm": "https://gitlab.matrix.org/api/v4/projects/27/packages/npm/@matrix-org/olm/-/@matrix-org/olm-3.2.8.tgz",
|
||||||
"another-json": "^0.2.0",
|
"another-json": "^0.2.0",
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
"@opentelemetry/semantic-conventions": "^1.3.1",
|
"@opentelemetry/semantic-conventions": "^1.3.1",
|
||||||
"dompurify": "^2.3.9",
|
"dompurify": "^2.3.9",
|
||||||
"express": "^4.17.2",
|
"express": "^4.17.2",
|
||||||
"hydrogen-view-sdk": "npm:@mlm/hydrogen-view-sdk@^0.24.0-scratch",
|
"hydrogen-view-sdk": "npm:@mlm/hydrogen-view-sdk@^0.25.0-scratch",
|
||||||
"json5": "^2.2.1",
|
"json5": "^2.2.1",
|
||||||
"linkedom": "^0.14.17",
|
"linkedom": "^0.14.17",
|
||||||
"matrix-public-archive-shared": "file:./shared/",
|
"matrix-public-archive-shared": "file:./shared/",
|
||||||
|
|
|
@ -6,20 +6,13 @@
|
||||||
// Data is passed in via `window.matrixPublicArchiveContext`
|
// Data is passed in via `window.matrixPublicArchiveContext`
|
||||||
|
|
||||||
const assert = require('matrix-public-archive-shared/lib/assert');
|
const assert = require('matrix-public-archive-shared/lib/assert');
|
||||||
const {
|
const { Platform, MediaRepository, createNavigation, createRouter } = require('hydrogen-view-sdk');
|
||||||
Platform,
|
|
||||||
MediaRepository,
|
|
||||||
createNavigation,
|
|
||||||
createRouter,
|
|
||||||
|
|
||||||
RetainedObservableValue,
|
|
||||||
PowerLevels,
|
|
||||||
} = require('hydrogen-view-sdk');
|
|
||||||
|
|
||||||
const ArchiveRoomView = require('matrix-public-archive-shared/views/ArchiveRoomView');
|
const ArchiveRoomView = require('matrix-public-archive-shared/views/ArchiveRoomView');
|
||||||
const ArchiveHistory = require('matrix-public-archive-shared/lib/archive-history');
|
const ArchiveHistory = require('matrix-public-archive-shared/lib/archive-history');
|
||||||
const supressBlankAnchorsReloadingThePage = require('matrix-public-archive-shared/lib/supress-blank-anchors-reloading-the-page');
|
const supressBlankAnchorsReloadingThePage = require('matrix-public-archive-shared/lib/supress-blank-anchors-reloading-the-page');
|
||||||
const ArchiveRoomViewModel = require('matrix-public-archive-shared/viewmodels/ArchiveRoomViewModel');
|
const ArchiveRoomViewModel = require('matrix-public-archive-shared/viewmodels/ArchiveRoomViewModel');
|
||||||
|
const stubPowerLevelsObservable = require('matrix-public-archive-shared/lib/stub-powerlevels-observable');
|
||||||
|
|
||||||
const fromTimestamp = window.matrixPublicArchiveContext.fromTimestamp;
|
const fromTimestamp = window.matrixPublicArchiveContext.fromTimestamp;
|
||||||
assert(fromTimestamp);
|
assert(fromTimestamp);
|
||||||
|
@ -98,19 +91,7 @@ async function mountHydrogen() {
|
||||||
mediaRepository: mediaRepository,
|
mediaRepository: mediaRepository,
|
||||||
// Based on https://github.com/vector-im/hydrogen-web/blob/5f9cfffa3b547991b665f57a8bf715270a1b2ef1/src/matrix/room/BaseRoom.js#L480
|
// Based on https://github.com/vector-im/hydrogen-web/blob/5f9cfffa3b547991b665f57a8bf715270a1b2ef1/src/matrix/room/BaseRoom.js#L480
|
||||||
observePowerLevels: async function () {
|
observePowerLevels: async function () {
|
||||||
let powerLevelsObservable = this._powerLevelsObservable;
|
return stubPowerLevelsObservable;
|
||||||
if (!powerLevelsObservable) {
|
|
||||||
const powerLevels = new PowerLevels({
|
|
||||||
powerLevelEvent: {},
|
|
||||||
ownUserId: 'xxx-ownUserId',
|
|
||||||
membership: null,
|
|
||||||
});
|
|
||||||
powerLevelsObservable = new RetainedObservableValue(powerLevels, () => {
|
|
||||||
this._powerLevels = null;
|
|
||||||
});
|
|
||||||
this._powerLevelsObservable = powerLevelsObservable;
|
|
||||||
}
|
|
||||||
return powerLevelsObservable;
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
const { RetainedObservableValue, PowerLevels } = require('hydrogen-view-sdk');
|
||||||
|
|
||||||
|
// Fake power levels for viewing the room anonymously
|
||||||
|
const stubPowerLevels = new PowerLevels({
|
||||||
|
powerLevelEvent: {},
|
||||||
|
ownUserId: 'xxx-ownUserId',
|
||||||
|
membership: null,
|
||||||
|
});
|
||||||
|
const stubPowerLevelsObservable = new RetainedObservableValue(stubPowerLevels, () => {
|
||||||
|
// freeCallback
|
||||||
|
//
|
||||||
|
// I don't think we need to do anything here 🤷
|
||||||
|
});
|
||||||
|
|
||||||
|
module.exports = stubPowerLevelsObservable;
|
|
@ -22,6 +22,7 @@ const AvatarViewModel = require('matrix-public-archive-shared/viewmodels/AvatarV
|
||||||
const {
|
const {
|
||||||
customTileClassForEntry,
|
customTileClassForEntry,
|
||||||
} = require('matrix-public-archive-shared/lib/custom-tile-utilities');
|
} = require('matrix-public-archive-shared/lib/custom-tile-utilities');
|
||||||
|
const stubPowerLevelsObservable = require('matrix-public-archive-shared/lib/stub-powerlevels-observable');
|
||||||
|
|
||||||
let txnCount = 0;
|
let txnCount = 0;
|
||||||
function getFakeEventId() {
|
function getFakeEventId() {
|
||||||
|
@ -371,6 +372,7 @@ class ArchiveRoomViewModel extends ViewModel {
|
||||||
fragmentIdComparer: fragmentIdComparer,
|
fragmentIdComparer: fragmentIdComparer,
|
||||||
clock: this.platform.clock,
|
clock: this.platform.clock,
|
||||||
logger: this.platform.logger,
|
logger: this.platform.logger,
|
||||||
|
powerLevelsObservable: stubPowerLevelsObservable,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Something we can modify with new state updates as we see them
|
// Something we can modify with new state updates as we see them
|
||||||
|
|
Loading…
Reference in New Issue