-
Notifications
You must be signed in to change notification settings - Fork 128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft: Scratch changes for matrix-public-archive
#653
Draft
MadLittleMods
wants to merge
71
commits into
master
Choose a base branch
from
madlittlemods/matrix-public-archive-scratch-changes
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 68 commits
Commits
Show all changes
71 commits
Select commit
Hold shift + click to select a range
dcc508c
Changes added to work on the Matrix public archive
MadLittleMods 5805ce0
Remove some scratch changes
MadLittleMods eda179a
Remove dom side-effect from rendering
MadLittleMods 4eb24db
Fix reply tiles not showing the new message
MadLittleMods 8d0c4e6
Some changes to support RoomView with no composer
MadLittleMods e75f18c
Support custom RightPanel content
MadLittleMods 48825ea
Use explicit HTML document boilerplate to get consistent results in b…
MadLittleMods 1032f4d
Merge branch 'master' into madlittlemods/matrix-public-archive-scratc…
MadLittleMods 6005fcf
Add permalink to timestamp
MadLittleMods a4cdde6
Use UTC timestamps and add data attribute for easy targeting in tests
MadLittleMods 3e58619
Add more SVG elements
MadLittleMods fc89bfd
Get rid of duplicate export
MadLittleMods 082d997
Only try to use window.crypto.subtle in secure contexts to avoid it t…
MadLittleMods ea2d45c
No need to comment this out since linkedom supports it now
MadLittleMods c24ac43
Merge branch 'master' into madlittlemods/matrix-public-archive-scratc…
MadLittleMods ae67386
Use correct variable in comment
MadLittleMods 2d3b78b
WIP: Make the lightbox open, not working yet
MadLittleMods 1a0b140
Working lightbox pops up and closes
MadLittleMods 5d9dc63
URL hashes relative to the room of the archive
MadLittleMods 72300d1
Lightbox escape keyboard shortcut also works
MadLittleMods 6a6f220
Merge branch 'master' into madlittlemods/matrix-public-archive-scratc…
MadLittleMods 8dc3c13
Ignore missing events
MadLittleMods 871cf1a
Revert "Ignore missing events"
MadLittleMods c824012
`this` doesn't work in strict mode which the SDK is exported as
MadLittleMods b54e884
Expose error when we fail to createObjectStore
MadLittleMods 88e2470
Scope log
MadLittleMods acaf53d
More exports
MadLittleMods 7c87e06
WIP: Custom room header
MadLittleMods c62c047
Merge branch 'master' into madlittlemods/matrix-public-archive-scratc…
MadLittleMods 36f26a0
Try fix no composer
MadLittleMods bdf820a
Include SDK asset build fix from https://github.com/vector-im/hydroge…
MadLittleMods eb470fa
Scratch changes for responsive and toggling right-panel via room header
MadLittleMods f2baf3d
Seems like an unused style that collides with styles in the archive t…
MadLittleMods fa0e487
Remove custom `none` composer in favor of useful HTML message in the …
MadLittleMods 98e0dd9
Make changes for stubbed PowerLevels
MadLittleMods 921544a
Add header/footer
MadLittleMods d5ba256
More necessary exports
MadLittleMods 7710580
Add style tag for adding dynamic debugging styles
MadLittleMods 89d044c
Add data-event-id to the AnnouncementView
MadLittleMods 127f39a
Log error caught in boundary to the console
MadLittleMods fa524d9
Add support for developer-options navigation
MadLittleMods 5ab01b6
Extra style for reference by children
MadLittleMods de261aa
Be able to access the event room_id
MadLittleMods e0e4868
Make the summary stick to the bottom
MadLittleMods 4d789bd
Merge branch 'master' into madlittlemods/matrix-public-archive-scratc…
MadLittleMods c94765e
Add new elements
MadLittleMods 7d4f2b3
Merge branch 'madlittlemods/matrix-public-archive-scratch-changes' of…
MadLittleMods 26cb86e
Add export
MadLittleMods 8911be8
Merge branch 'master' into madlittlemods/matrix-public-archive-scratc…
MadLittleMods 9f5e66e
Add details element
MadLittleMods 1d9c1bf
Add a way to change the anchor position to the top of a node
MadLittleMods 4e3f397
Revert "Add a way to change the anchor position to the top of a node"
MadLittleMods 5fdbe61
Add a way to toggle scrollToBottom so you can start scroll from the t…
MadLittleMods c9859ff
Add a way to change the anchor position to the top of a node
MadLittleMods 7602825
Re-add way to align scroll top to event
MadLittleMods dc6ab45
Add a way to highlight tiles
MadLittleMods ceca3d1
Add a way to scroll to the given highlighted event
MadLittleMods b84dd3b
Fix tsc error
MadLittleMods 65ec71b
Prevent messages nested in a reply from being highlighted
MadLittleMods 168788d
Add MXID as title tooltip
MadLittleMods 847482f
Add full MXID to message avatar/sender
MadLittleMods bb51174
Fix AnnouncementView member events not highlighting
MadLittleMods 07cc95c
Add different hover styles so it's more obvious if you page-load with…
MadLittleMods 7c52de3
Merge branch 'master' into madlittlemods/matrix-public-archive-scratc…
MadLittleMods 64b6ba1
Add copy permalink action
MadLittleMods 72837d8
Remove matrix.to link from message timestamp since we have an context…
MadLittleMods 84029d5
Merge branch 'master' into madlittlemods/matrix-public-archive-scratc…
MadLittleMods 987d27a
Increase width to accomodate long dates with year like 'Wednesday, No…
MadLittleMods ba0eb55
Add ApplyMap to exports
MadLittleMods f1ec4d4
Add MXC URL's as data-attribute for easy reference
MadLittleMods 8034c53
Backport fix to make SDK depedencies available when npm linking
MadLittleMods File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* | ||
Copyright 2022 Bruno Windels <bruno@windels.cloud> | ||
Copyright 2022 The Matrix.org Foundation C.I.C. | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
import {LightboxViewModel} from "./LightboxViewModel.js"; | ||
|
||
// Store the `LightboxViewModel` under a symbol so no one else can tamper with | ||
// it. This acts like a private field on the class since no one else has the | ||
// symbol to look it up. | ||
let lightboxViewModelSymbol = Symbol('lightboxViewModel'); | ||
|
||
/** | ||
* Destroys and creates a new the `LightboxViewModel` depending if | ||
* `lightboxChildOptions.eventEntry` or `lightboxChildOptions.eventId` are | ||
* provided. | ||
*/ | ||
function updateLightboxViewModel(vm, fieldName, lightboxChildOptions) { | ||
// Remove any existing `LightboxViewModel` before we assemble the new one below | ||
if (vm[lightboxViewModelSymbol]) { | ||
vm[lightboxViewModelSymbol] = vm.disposeTracked(vm[lightboxViewModelSymbol]); | ||
// Let the `LightboxView` know that the `LightboxViewModel` has changed | ||
vm.emitChange(fieldName); | ||
} | ||
// Create the new `LightboxViewModel` if the `eventEntry` exists directly or | ||
// `eventId` which we can load from the store | ||
if (lightboxChildOptions.eventId || lightboxChildOptions.eventEntry) { | ||
vm[lightboxViewModelSymbol] = vm.track(new LightboxViewModel(vm.childOptions(lightboxChildOptions))); | ||
// Let the `LightboxView` know that the `LightboxViewModel` has changed | ||
vm.emitChange(fieldName); | ||
} | ||
} | ||
|
||
/** | ||
* Handles updating the `LightboxViewModel` whenever the page URL changes and | ||
* emits changes which the `LightboxView` will use to re-render. This is a | ||
* composable piece of logic to call in an existing `ViewModel`'s constructor. | ||
*/ | ||
export function setupLightboxNavigation(vm, fieldName = 'lightboxViewModel', lightboxChildOptionsFunction) { | ||
// On the given `vm`, create a getter at `fieldName` that the | ||
// `LightboxViewModel` is exposed at for usage in the view. | ||
Object.defineProperty(vm, fieldName, { | ||
get: function() { | ||
return vm[lightboxViewModelSymbol]; | ||
} | ||
}); | ||
|
||
// Whenever the page navigates somewhere, keep the `lightboxViewModel` up to date | ||
const lightbox = vm.navigation.observe("lightbox"); | ||
vm.track(lightbox.subscribe(eventId => { | ||
updateLightboxViewModel(vm, fieldName, lightboxChildOptionsFunction(eventId)); | ||
})); | ||
// Also handle the case where the URL already includes `/lightbox/$eventId` (like | ||
// from page-load) | ||
const initialLightBoxEventId = lightbox.get(); | ||
updateLightboxViewModel(vm, fieldName, lightboxChildOptionsFunction(initialLightBoxEventId)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -85,6 +85,7 @@ export class Timeline { | |
const readerRequest = this._disposables.track(this._timelineReader.readFromEnd(20, txn, log)); | ||
try { | ||
const entries = await readerRequest.complete(); | ||
console.log('entries', entries) | ||
this._loadContextEntriesWhereNeeded(entries); | ||
this._setupEntries(entries); | ||
} finally { | ||
|
@@ -198,8 +199,10 @@ export class Timeline { | |
if (!this._localEntries?.hasSubscriptions) { | ||
return; | ||
} | ||
// find any local relations to this new remote event | ||
for (const pee of this._localEntries) { | ||
// find any local relations to these new remote events or maybe these | ||
// new remote events reference one of the other new remote events we have. | ||
const entryList = new ConcatList(entries, this._localEntries); | ||
for (const pee of entryList) { | ||
Comment on lines
+202
to
+205
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Split off to #860 |
||
// this will work because we set relatedEventId when removing remote echos | ||
if (pee.relatedEventId) { | ||
const relationTarget = entries.find(e => e.id === pee.relatedEventId); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes emoji reactions show up on messages.
(the
m.reaction
events are in the list of events we're rendering)