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 833
Fix editing event from search room view #11992
Merged
Merged
Changes from 5 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
ef412b9
Fix editing event from search room view
t3chguy 13325ca
Merge branch 'develop' of github.com:matrix-org/matrix-react-sdk into…
t3chguy b869117
Iterate
t3chguy 81f6052
Handle different room for all rooms search case
t3chguy 411ac0a
Iterate
t3chguy b0bdaa0
Iterate
t3chguy 1024b98
Add tests
t3chguy 41c930a
Merge branch 'develop' of github.com:matrix-org/matrix-react-sdk into…
t3chguy 982147d
Increase coverage
t3chguy 05ee015
Merge branch 'develop' into t3chguy/fix/26508
t3chguy 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -186,6 +186,9 @@ export interface IRoomState { | |
initialEventScrollIntoView?: boolean; | ||
replyToEvent?: MatrixEvent; | ||
numUnreadMessages: number; | ||
/** | ||
* The state of an ongoing search if there is one. | ||
*/ | ||
search?: ISearchInfo; | ||
callState?: CallState; | ||
activeCall: Call | null; | ||
|
@@ -1208,12 +1211,30 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> { | |
case Action.EditEvent: { | ||
// Quit early if we're trying to edit events in wrong rendering context | ||
if (payload.timelineRenderingType !== this.state.timelineRenderingType) return; | ||
if (payload.event && payload.event.getRoomId() !== this.state.roomId) { | ||
// If the event is in a different room (e.g. all rooms search), we need to view that room first | ||
dis.dispatch<ViewRoomPayload>({ | ||
action: Action.ViewRoom, | ||
room_id: payload.event?.getRoomId(), | ||
t3chguy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
metricsTrigger: undefined, | ||
deferred_action: payload, | ||
}); | ||
return; | ||
} | ||
|
||
const editState = payload.event ? new EditorStateTransfer(payload.event) : undefined; | ||
this.setState({ editState }, () => { | ||
if (payload.event) { | ||
this.messagePanel?.scrollToEventIfNeeded(payload.event.getId()); | ||
} | ||
}); | ||
this.setState( | ||
{ | ||
editState, | ||
// Close any ongoing search as the RoomSearchView doesn't pass editState and thus won't render the edit composer | ||
t3chguy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
search: undefined, | ||
}, | ||
() => { | ||
if (payload.event) { | ||
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. feel like maybe we should have an 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 isn't my doing, its green because of an indent change performed by Prettier |
||
this.messagePanel?.scrollToEventIfNeeded(payload.event.getId()); | ||
} | ||
}, | ||
); | ||
break; | ||
} | ||
|
||
|
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.