-
-
Notifications
You must be signed in to change notification settings - Fork 827
Fix timestamp and read receipt group placement on ThreadView #10335
Changes from all commits
f98fcd7
556daae
66ecfac
c2f0cf6
6e1688b
41638c5
fd669a3
a26a154
6b5f515
691e00b
deb38da
6cb5e59
30162b4
a663e7f
41ee51d
9c19038
5b7784b
6c9c48d
738ffc2
45ca4f4
f452adb
dc6b38d
dd17368
6684e0b
e63aa2b
d1f9eba
2acac19
e87f979
7741c61
bce1619
9cd24ff
ac48775
1e9bb9a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -129,15 +129,27 @@ describe("Threads", () => { | |
// Enable the bubble layout | ||
cy.setSettingValue("layout", null, SettingLevel.DEVICE, Layout.Bubble); | ||
|
||
cy.get(".mx_ThreadView .mx_EventTile[data-layout='bubble'].mx_EventTile_last").within(() => { | ||
// TODO: remove this after fixing the issue of ReadReceiptGroup being hidden on the bubble layout | ||
// See: https://github.com/vector-im/element-web/issues/23569 | ||
cy.get(".mx_ReadReceiptGroup .mx_BaseAvatar_image").should("exist"); | ||
|
||
cy.get(".mx_ThreadView").within(() => { | ||
// Make sure the avatar inside ReadReceiptGroup is visible on bubble layout | ||
// TODO: enable this after fixing the issue of ReadReceiptGroup being hidden on the bubble layout | ||
// See: https://github.com/vector-im/element-web/issues/23569 | ||
// cy.get(".mx_ReadReceiptGroup .mx_BaseAvatar_image").should("be.visible"); | ||
cy.get( | ||
".mx_EventTile[data-layout='bubble'].mx_EventTile_last .mx_ReadReceiptGroup .mx_BaseAvatar_image", | ||
).should("be.visible"); | ||
|
||
// Make sure the option button of MessageActionBar on the left bubble is visible | ||
cy.get(".mx_EventTile[data-layout='bubble'][data-self='false']") | ||
.should("exist") | ||
.realHover() | ||
.within(() => { | ||
cy.get(".mx_MessageActionBar [aria-label='Options']").should("be.visible"); | ||
}); | ||
|
||
// Make sure the option button of MessageActionBar on the right bubble is visible | ||
cy.get(".mx_EventTile[data-layout='bubble'][data-self='true']") | ||
.should("exist") | ||
.realHover() | ||
.within(() => { | ||
cy.get(".mx_MessageActionBar [aria-label='Options']").should("be.visible"); | ||
}); | ||
}); | ||
|
||
// Re-enable the group layout | ||
|
@@ -195,20 +207,30 @@ describe("Threads", () => { | |
percyCSS, | ||
}); | ||
|
||
cy.get(".mx_ThreadView .mx_GenericEventListSummary[data-layout=group]").within(() => { | ||
cy.get(".mx_EventTile_info.mx_EventTile_last .mx_EventTile_line") | ||
// Select the hidden event | ||
.rightclick(); | ||
|
||
// Ensure the same CSS style for spacing is applied to the selected hidden event | ||
cy.get(".mx_EventTile_info.mx_EventTile_selected.mx_EventTile_last .mx_EventTile_line").should( | ||
"have.css", | ||
"padding-inline-start", | ||
ThreadViewGroupSpacingStart, | ||
); | ||
}); | ||
|
||
// Enable bubble layout | ||
cy.setSettingValue("layout", null, SettingLevel.DEVICE, Layout.Bubble); | ||
|
||
// Make sure the CSS style for spacing is applied to the hidden event on bubble layout | ||
cy.get( | ||
".mx_ThreadView .mx_GenericEventListSummary[data-layout=bubble] .mx_EventTile_info.mx_EventTile_last", | ||
).within(() => { | ||
cy.get(".mx_EventTile_line .mx_EventTile_content") | ||
// 76px: ThreadViewGroupSpacingStart + 14px + 6px | ||
// 14px: avatar width | ||
// See: _EventTile.pcss | ||
.should("have.css", "margin-inline-start", "76px"); | ||
cy.get(".mx_EventTile_line") | ||
// Make sure the margin is NOT applied to mx_EventTile_line | ||
cy.get(".mx_ThreadView .mx_GenericEventListSummary[data-layout=bubble]").within(() => { | ||
cy.get(".mx_EventTile_info.mx_EventTile_last") | ||
// 49px: --EventTile_bubble-margin-inline-start | ||
.should("have.css", "margin-inline-start", "49px"); | ||
|
||
cy.get(".mx_EventTile_info.mx_EventTile_last .mx_EventTile_line .mx_EventTile_content") | ||
// Make sure the margin is NOT applied to mx_EventTile_content | ||
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. |
||
.should("have.css", "margin-inline-start", "0px"); | ||
}); | ||
|
||
|
@@ -302,11 +324,27 @@ describe("Threads", () => { | |
cy.get(".mx_RoomView_body .mx_ThreadSummary .mx_ThreadSummary_sender").should("contain", "Tom"); | ||
cy.get(".mx_RoomView_body .mx_ThreadSummary .mx_ThreadSummary_content").should("contain", "Great!"); | ||
|
||
// User edits & asserts | ||
// User edits | ||
cy.contains(".mx_ThreadView .mx_EventTile_last .mx_EventTile_line", "Great!").within(() => { | ||
cy.get('[aria-label="Edit"]').click({ force: true }); // Cypress has no ability to hover | ||
cy.get(".mx_BasicMessageComposer_input").type(" How about yourself?{enter}"); | ||
cy.get(".mx_BasicMessageComposer_input").type(" How about yourself?"); | ||
}); | ||
|
||
// Ensure the read receipt group on the edited message EventTile is visible | ||
cy.get(".mx_ThreadView .mx_EventTile_isEditing .mx_EventTile_receiptSent").should("be.visible"); | ||
|
||
// Take snapshot of the edited EventTile on modern layout | ||
cy.get(".mx_ThreadView .mx_EventTile_last[data-layout=group]").percySnapshotElement( | ||
"EditMessageComposer on bubble layout", | ||
{ | ||
percyCSS, | ||
}, | ||
); | ||
|
||
// User saves the edit | ||
cy.get(".mx_ThreadView .mx_EventTile_last .mx_EventTile_line .mx_BasicMessageComposer_input").type("{enter}"); | ||
|
||
// User asserts | ||
cy.get(".mx_RoomView_body .mx_ThreadSummary .mx_ThreadSummary_sender").should("contain", "Tom"); | ||
cy.get(".mx_RoomView_body .mx_ThreadSummary .mx_ThreadSummary_content").should( | ||
"contain", | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -16,9 +16,15 @@ limitations under the License. | |||||
|
||||||
.mx_BaseCard { | ||||||
--BaseCard_padding-inline: $spacing-8; | ||||||
--BaseCard_header-button-size: 24px; | ||||||
--BaseCard_EventTile_line-padding-block: 2px; | ||||||
--BaseCard_EventTile-spacing-inline: 36px; /* TODO: Use a spacing variable */ | ||||||
--BaseCard_header-button-size: 24px; | ||||||
|
||||||
/* Moving the read receipts group inside BaseCard */ | ||||||
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. Comments should be in the imperative ("Move"), not the present participle ("Moving"). But in this case, the useful information is what this variable does, rather than how it is calculated.
Suggested change
|
||||||
/* stylelint-disable-next-line declaration-colon-space-after */ | ||||||
--BaseCard_EventTile_bubble_RR-inset-inline-end: calc( | ||||||
-1 * var(--ReadReceiptGroup_EventBubbleTile-spacing-end) + $container-gap-width + var(--BaseCard_padding-inline) | ||||||
); | ||||||
|
||||||
padding: 0 var(--BaseCard_padding-inline); | ||||||
overflow: hidden; | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -170,16 +170,12 @@ limitations under the License. | |
flex-basis: 48px; /* 12 (padding on message list) + 36 (padding on event lines) */ | ||
} | ||
|
||
.mx_GenericEventListSummary_unstyledList, /* RR next to a message on the event list summary */ | ||
.mx_GenericEventListSummary_unstyledList, | ||
.mx_RoomView_MessageList { | ||
/* RR next to a message on the messsge list */ | ||
.mx_EventTile[data-layout="bubble"] { | ||
/* RR next to a message, in either an event list summary or the message list */ | ||
.mx_ReadReceiptGroup { | ||
/* 6px: scroll bar width (magic number) */ | ||
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. It looks that the magic number should in fact have been |
||
/* stylelint-disable-next-line declaration-colon-space-after */ | ||
inset-inline-end: calc( | ||
-1 * var(--ReadReceiptGroup_EventBubbleTile-spacing-end) + $container-gap-width + 6px | ||
); | ||
inset-inline-end: var(--BaseCard_EventTile_bubble_RR-inset-inline-end); | ||
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. 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. Once more, just linking to a diff isn't very helpful. In this case, this is a link to the other place that |
||
} | ||
|
||
&.mx_EventTile_info { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1032,77 +1032,106 @@ $left-gutter: 64px; | |
--ThreadView_group_spacing-end: 8px; /* same as padding */ | ||
|
||
.mx_EventTile { | ||
display: flex; | ||
flex-direction: column; | ||
Comment on lines
-1035
to
-1036
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. why is it safe to remove these? |
||
|
||
.mx_EventTile_roomName { | ||
display: none; | ||
} | ||
|
||
/* handling for hidden events (e.g reactions) in the thread view */ | ||
&.mx_EventTile_info { | ||
.mx_EventTile_avatar { | ||
position: absolute; | ||
top: 1.5px; /* Align with hidden event content */ | ||
margin-top: 0; | ||
margin-bottom: 0; | ||
margin-block: 0; | ||
Comment on lines
-1047
to
+1042
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. I have to say, I find the separate |
||
width: 14px; /* avatar img size */ | ||
height: 14px; /* avatar img size */ | ||
} | ||
|
||
.mx_ViewSourceEvent_toggle { | ||
display: none; /* hide the hidden event expand button, not enough | ||
space, view source can still be used */ | ||
} | ||
|
||
Comment on lines
-1053
to
-1057
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. is moving this necessary? |
||
&.mx_EventTile_selected .mx_EventTile_line, | ||
.mx_EventTile_line { | ||
$line-height: $font-12px; | ||
|
||
padding-inline-start: 0; | ||
line-height: $line-height; | ||
|
||
/* hidden event content */ | ||
.mx_EventTile_content, | ||
/* redacted hidden event */ | ||
.mx_RedactedBody { | ||
width: auto; | ||
font-size: $line-height; | ||
} | ||
} | ||
|
||
.mx_ViewSourceEvent_toggle { | ||
display: none; /* hide the hidden event expand button, not enough | ||
space, view source can still be used */ | ||
} | ||
|
||
/* Required for override */ | ||
&[data-layout="irc"], | ||
&[data-layout="group"], | ||
&[data-layout="bubble"] { | ||
/* Override | ||
.mx_ThreadView .mx_EventTile[data-layout="group"], | ||
.mx_GenericEventListSummary[data-layout="bubble"][data-expanded="true"] .mx_EventTile_info */ | ||
padding-block: 0; | ||
|
||
/* Add padding to hidden event line of all of the layouts, including bubble layout */ | ||
.mx_EventTile_line { | ||
padding-block: var(--BaseCard_EventTile_line-padding-block); | ||
} | ||
} | ||
|
||
&[data-layout="irc"], | ||
&[data-layout="group"] { | ||
padding-top: 0; | ||
|
||
.mx_EventTile_avatar { | ||
position: absolute; | ||
top: 1.5px; /* Align with hidden event content */ | ||
left: calc($MessageTimestamp_width + 14px - 4px); /* 14px: avatar width, 4px: align with text */ | ||
z-index: 9; /* position above the hover styling */ | ||
} | ||
|
||
.mx_MessageTimestamp { | ||
top: 2px; /* Align with avatar */ | ||
} | ||
|
||
&.mx_EventTile_selected .mx_EventTile_line, | ||
.mx_EventTile_line { | ||
.mx_EventTile_content, | ||
.mx_RedactedBody { | ||
/* Add space between avatar and hidden event content */ | ||
/* 14px: avatar width, 6px: 20px - 14px */ | ||
margin-inline-start: calc(14px + 6px); | ||
} | ||
} | ||
|
||
&.mx_EventTile_selected .mx_EventTile_line { | ||
/* Override | ||
.mx_EventTile[data-layout="group"].mx_EventTile_info.mx_EventTile_selected .mx_EventTile_line */ | ||
padding-inline-start: var(--ThreadView_group_spacing-start); | ||
} | ||
|
||
.mx_MessageTimestamp { | ||
top: 2px; /* Align with avatar */ | ||
} | ||
|
||
.mx_ReadReceiptGroup { | ||
inset-block-start: calc(-$font-22px); /* Align with hidden event content */ | ||
} | ||
|
||
&:hover { | ||
&.mx_EventTile_verified.mx_EventTile_info .mx_EventTile_line, | ||
&.mx_EventTile_unverified.mx_EventTile_info .mx_EventTile_line, | ||
&.mx_EventTile_unknown.mx_EventTile_info .mx_EventTile_line { | ||
padding-inline-start: var(--ThreadView_group_spacing-start); /* Override */ | ||
} | ||
} | ||
} | ||
|
||
&[data-layout="bubble"] { | ||
.mx_EventTile_avatar { | ||
inset-inline-start: 0; | ||
/* Same declaration as the main timeline */ | ||
margin-inline: var(--EventTile_bubble-margin-inline-start) 0; | ||
|
||
/* Shadow on hover */ | ||
&::before { | ||
/* Apply the same value as the main timeline */ | ||
inset-inline: calc(-1 * var(--EventTile_bubble-margin-inline-start)) 0; | ||
} | ||
|
||
&.mx_EventTile_selected .mx_EventTile_line, | ||
.mx_EventTile_line { | ||
.mx_EventTile_content, | ||
.mx_RedactedBody { | ||
margin-inline-start: calc(var(--ThreadView_group_spacing-start) + 14px + 6px); | ||
} | ||
.mx_ReadReceiptGroup { | ||
/* Move read receipt group inside ThreadView */ | ||
inset-inline-end: 0; | ||
} | ||
} | ||
} | ||
|
@@ -1172,16 +1201,18 @@ $left-gutter: 64px; | |
&.mx_EventTile_verified.mx_EventTile_info .mx_EventTile_line, | ||
&.mx_EventTile_unverified.mx_EventTile_info .mx_EventTile_line, | ||
&.mx_EventTile_unknown.mx_EventTile_info .mx_EventTile_line { | ||
padding-inline-start: 0; | ||
padding-inline-start: 0; /* TODO: investigate where this is used */ | ||
} | ||
} | ||
} | ||
|
||
&[data-layout="bubble"] { | ||
margin-inline: var(--BaseCard_EventTile-spacing-inline); | ||
margin-inline-start: var(--BaseCard_EventTile-spacing-inline); | ||
margin-inline-end: var(--EventTile_bubble-margin-inline-end); /* Reserve space for read receipt group */ | ||
|
||
&::before { | ||
inset-inline: calc(-1 * var(--BaseCard_EventTile-spacing-inline)); | ||
inset-inline-start: calc(-1 * var(--BaseCard_EventTile-spacing-inline)); | ||
inset-inline-end: calc(-1 * var(--EventTile_bubble-margin-inline-end)); | ||
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. 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. please don't just link to another line in the diff. What am I supposed to learn by looking at that link? |
||
z-index: auto; /* enable background color on hover */ | ||
} | ||
|
||
|
@@ -1195,9 +1226,11 @@ $left-gutter: 64px; | |
max-width: var(--EventBubbleTile_line-max-width); | ||
} | ||
|
||
&[data-self="true"] { | ||
align-items: flex-end; | ||
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. 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. again, what do I learn by looking at that link? |
||
.mx_ReadReceiptGroup { | ||
inset-inline-end: var(--BaseCard_EventTile_bubble_RR-inset-inline-end); | ||
} | ||
|
||
&[data-self="true"] { | ||
.mx_EventTile_line.mx_EventTile_mediaLine { | ||
margin: 0 var(--EventTile_bubble_line-margin-inline-end) 0 0; /* align with normal messages */ | ||
} | ||
|
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -14,9 +14,12 @@ See the License for the specific language governing permissions and | |||||||
limitations under the License. | ||||||||
*/ | ||||||||
|
||||||||
.mx_ReadReceiptGroup { | ||||||||
/* Required due to alphabetic order of CSS import */ | ||||||||
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. we do this elsewhere without a comment; I don't think the comment here is that helpful.
Suggested change
|
||||||||
:root { | ||||||||
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. Otherwise this variable could not be used on |
||||||||
--ReadReceiptGroup_EventBubbleTile-spacing-end: 78px; | ||||||||
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. it would be good to add a comment saying what this variable does though. I'm struggling to figure it out. The best definition I came up with was:
Suggested change
Any better ideas? (why isn't it just -78px, to save us doing |
||||||||
} | ||||||||
|
||||||||
.mx_ReadReceiptGroup { | ||||||||
position: relative; | ||||||||
display: inline-block; | ||||||||
user-select: none; | ||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1197,8 +1197,8 @@ export class UnwrappedEventTile extends React.Component<EventTileProps, IState> | |
<a href={permalink} onClick={this.onPermalinkClicked}> | ||
{timestamp} | ||
</a> | ||
{msgOption} | ||
</div>, | ||
msgOption, | ||
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. See: https://github.com/matrix-org/matrix-react-sdk/pull/10335/files#diff-9ff5535291b7c2e655ccd3d02c4f632b6f2dc9c30072514641e31c2a8751c57eR1287 and https://github.com/matrix-org/matrix-react-sdk/pull/10335/files#diff-9ff5535291b7c2e655ccd3d02c4f632b6f2dc9c30072514641e31c2a8751c57eR1398. Both of them are placed outside of 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. I didn't understand what these links were supposed to tell me. For the benefit of future reviewers: This brings |
||
reactionsRow, | ||
], | ||
); | ||
|
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.
https://github.com/matrix-org/matrix-react-sdk/pull/10335/files#diff-5d3e25eb1d22dd7a96e0e87ea9c1298dc7dbce8eb965d30b2d1ebc1436bfec3fR1108