This repository has been archived by the owner on Sep 11, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 827
Ask to refresh timeline when historical messages are imported (MSC2716) #8303
Closed
MadLittleMods
wants to merge
11
commits into
develop
from
madlittlemods/refresh-timeline-when-we-see-msc2716-marker-events
Closed
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
66ea757
Ask to refresh timeline when historical messages are imported (MSC2716)
MadLittleMods 6dba3df
Back to false after getting screenshot
MadLittleMods 12b0115
Fix lints
MadLittleMods eb5e899
Fix room not showing refresh timeline banner if not switched to the r…
MadLittleMods a50e011
Fix type lints
MadLittleMods ed910bb
Remove parenthesis change
MadLittleMods 8d61226
Raw refreshLiveTimeline usage that seems to work
MadLittleMods d8f94ed
Clean up raw commit
MadLittleMods c43d309
Merge branch 'develop' into madlittlemods/refresh-timeline-when-we-se…
MadLittleMods 623960b
Clean up event usage
MadLittleMods d9001ce
Remove unreadable image descriptions
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
Original file line number | Diff line number | Diff line change | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -280,6 +280,7 @@ class TimelinePanel extends React.Component<IProps, IState> { | |||||||||||||||
const cli = MatrixClientPeg.get(); | ||||||||||||||||
cli.on(RoomEvent.Timeline, this.onRoomTimeline); | ||||||||||||||||
cli.on(RoomEvent.TimelineReset, this.onRoomTimelineReset); | ||||||||||||||||
this.props.timelineSet.room.on(RoomEvent.TimelineRefresh, this.onRoomTimelineRefresh); | ||||||||||||||||
cli.on(RoomEvent.Redaction, this.onRoomRedaction); | ||||||||||||||||
if (SettingsStore.getValue("feature_msc3531_hide_messages_pending_moderation")) { | ||||||||||||||||
// Make sure that events are re-rendered when their visibility-pending-moderation changes. | ||||||||||||||||
|
@@ -338,6 +339,14 @@ class TimelinePanel extends React.Component<IProps, IState> { | |||||||||||||||
} | ||||||||||||||||
} | ||||||||||||||||
|
||||||||||||||||
public componentDidUpdate(prevProps): void { | ||||||||||||||||
// When the room changes, setup the new listener | ||||||||||||||||
if(prevProps.timelineSet.room !== this.props.timelineSet.room) { | ||||||||||||||||
prevProps.timelineSet.room.removeListener(RoomEvent.TimelineRefresh, this.onRoomTimelineRefresh); | ||||||||||||||||
this.props.timelineSet.room.on(RoomEvent.TimelineRefresh, this.onRoomTimelineRefresh); | ||||||||||||||||
} | ||||||||||||||||
} | ||||||||||||||||
|
||||||||||||||||
componentWillUnmount() { | ||||||||||||||||
// set a boolean to say we've been unmounted, which any pending | ||||||||||||||||
// promises can use to throw away their results. | ||||||||||||||||
|
@@ -370,6 +379,8 @@ class TimelinePanel extends React.Component<IProps, IState> { | |||||||||||||||
client.removeListener(MatrixEventEvent.VisibilityChange, this.onEventVisibilityChange); | ||||||||||||||||
client.removeListener(ClientEvent.Sync, this.onSync); | ||||||||||||||||
} | ||||||||||||||||
|
||||||||||||||||
this.props.timelineSet.room.removeListener(RoomEvent.TimelineRefresh, this.onRoomTimelineRefresh); | ||||||||||||||||
} | ||||||||||||||||
|
||||||||||||||||
private onMessageListUnfillRequest = (backwards: boolean, scrollToken: string): void => { | ||||||||||||||||
|
@@ -627,10 +638,18 @@ class TimelinePanel extends React.Component<IProps, IState> { | |||||||||||||||
}); | ||||||||||||||||
}; | ||||||||||||||||
|
||||||||||||||||
private onRoomTimelineRefresh = (room: Room, timelineSet: EventTimelineSet): void => { | ||||||||||||||||
debuglog(`onRoomTimelineRefresh skipping=${timelineSet !== this.props.timelineSet}`); | ||||||||||||||||
if (timelineSet !== this.props.timelineSet) return; | ||||||||||||||||
|
||||||||||||||||
this.refreshTimeline(); | ||||||||||||||||
}; | ||||||||||||||||
|
||||||||||||||||
private onRoomTimelineReset = (room: Room, timelineSet: EventTimelineSet): void => { | ||||||||||||||||
debuglog(`onRoomTimelineReset skipping=${timelineSet !== this.props.timelineSet} skippingBecauseAtBottom=${this.canResetTimeline()}`); | ||||||||||||||||
if (timelineSet !== this.props.timelineSet) return; | ||||||||||||||||
|
||||||||||||||||
if (this.messagePanel.current && this.messagePanel.current.isAtBottom()) { | ||||||||||||||||
if (this.canResetTimeline()) { | ||||||||||||||||
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. This seems like a missed refactor. matrix-react-sdk/src/components/structures/RoomView.tsx Lines 1004 to 1009 in 27118a9
|
||||||||||||||||
this.loadTimeline(); | ||||||||||||||||
} | ||||||||||||||||
}; | ||||||||||||||||
|
@@ -1319,6 +1338,7 @@ class TimelinePanel extends React.Component<IProps, IState> { | |||||||||||||||
// get the list of events from the timeline window and the pending event list | ||||||||||||||||
private getEvents(): Pick<IState, "events" | "liveEvents" | "firstVisibleEventIndex"> { | ||||||||||||||||
const events: MatrixEvent[] = this.timelineWindow.getEvents(); | ||||||||||||||||
console.log('TimelinePanel: getEvents', events.length); | ||||||||||||||||
|
||||||||||||||||
// `arrayFastClone` performs a shallow copy of the array | ||||||||||||||||
// we want the last event to be decrypted first but displayed last | ||||||||||||||||
|
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
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.
I think the behavior of all of this would be best served by an end-to-end test. It looks like we just added Cypress recently but it's missing all of the utility necessary to complete something like this.
experimental_features
in thehomeserver.yaml
template/batch_send
endpoint is only accessible from a AS token. No extra AS server needed, just the AS token configured./batch_send
(probably viamatrix-js-sdk
)I can't find an overall issue describing the need/want to use Cypress so it's unclear how much we want to move forward with it. I've had many troubles using Cypress with Gitter.
It seems like we have other e2e tests using Puppeteer but I'm guessing we want to move all of these to Cypress. Better place I should be adding some e2e tests or approaching this?
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.
Conversation continued at #8354 (comment)