Skip to content

Commit

Permalink
Iterate on search results for message bubbles (#7047)
Browse files Browse the repository at this point in the history
* 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 matrix-org/matrix-js-sdk#2004

* Tweak opacity

Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
  • Loading branch information
turt2live and t3chguy committed May 13, 2022
1 parent 6d6cfcd commit bc0bfa6
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
21 changes: 21 additions & 0 deletions res/css/views/rooms/_EventBubbleTile.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion src/components/views/rooms/EventTile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down

0 comments on commit bc0bfa6

Please sign in to comment.