Iterate on search results for message bubbles (#7047)

* PSFD-455: Iterate on search results for message bubbles

Though not perfect, this is a bit better than it was before. Specifically, we ensure our matching for `isOwnEvent` correctly identifies the user and that the results don't look *awful*. 

There's still room for improvement, but this should be a measurable improvement itself. Most notably, this doesn't fix a couple obvious bugs due to complexity:
* Message bubbles have the wrong corners for the display format (pre-existing).
* The sender's own messages are missing avatars/names. This is just way too complex to fix.

**Requires https://github.com/matrix-org/matrix-js-sdk/pull/2004**

* Tweak opacity

Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Travis Ralston 2022-05-13 09:20:43 -06:00 committed by GitHub
parent 6d6cfcde11
commit bc0bfa6377
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 1 deletions

View File

@ -31,6 +31,27 @@ limitations under the License.
margin-right: 60px;
}
.mx_RoomView_searchResultsPanel {
.mx_EventTile[data-layout=bubble] {
.mx_SenderProfile {
// Group layout adds a 64px left margin, which we really don't want on search results
margin-left: 0;
}
&[data-self=true] {
// The avatars end up overlapping, so just hide them
.mx_EventTile_avatar {
display: none;
}
}
// Mirror rough designs for "greyed out" text
&.mx_EventTile_contextual .mx_EventTile_line {
opacity: 0.4;
}
}
}
.mx_EventTile[data-layout=bubble] {
position: relative;
margin-top: var(--gutterSize);

View File

@ -1235,7 +1235,8 @@ export class UnwrappedEventTile extends React.Component<IProps, IState> {
/>;
}
const isOwnEvent = this.props.mxEvent?.sender?.userId === MatrixClientPeg.get().getUserId();
// Use `getSender()` because searched events might not have a proper `sender`.
const isOwnEvent = this.props.mxEvent?.getSender() === MatrixClientPeg.get().getUserId();
switch (this.context.timelineRenderingType) {
case TimelineRenderingType.Notification: {