Fix encryption badge layouts and replies.

Begin removing dependence on slider.
Move settings to labs.
Username disambiguation.
This commit is contained in:
Jorik Schellekens 2020-05-07 13:55:23 +01:00
parent 5568e6488d
commit 771ae5e18f
7 changed files with 69 additions and 18 deletions

View file

@ -14,14 +14,14 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
$name-width: 50px; $name-width: 70px;
$icon-width: 14px; $icon-width: 14px;
$timestamp-width: 45px; $timestamp-width: 45px;
$right-padding: 5px; $right-padding: 5px;
.mx_IRCLayout { .mx_IRCLayout {
line-height: $font-22px !important; line-height: $font-20px !important;
.mx_EventTile { .mx_EventTile {
display: flex; display: flex;
@ -46,11 +46,13 @@ $right-padding: 5px;
text-align: right; text-align: right;
display: flex; display: flex;
align-items: center; align-items: center;
overflow: visible;
} }
> .mx_EventTile_line { > .mx_EventTile_line {
order: 3; order: 3;
flex-grow: 1; flex-grow: 1;
margin-bottom: -6px;
} }
> .mx_EventTile_avatar { > .mx_EventTile_avatar {
@ -90,10 +92,13 @@ $right-padding: 5px;
padding: 0; padding: 0;
} }
.mx_EventTile_line .mx_EventTile_content, .mx_EventTile_line {
.mx_EventTile_line .mx_EventTile_e2eIcon, .mx_EventTile_e2eIcon,
.mx_EventTile_line .mx_ReplyThread_wrapper_empty { .mx_TextualEvent,
display: inline-block; .mx_MTextBody,
.mx_ReplyThread_wrapper_empty {
display: inline-block;
}
} }
.mx_EvenTile_line .mx_MessageActionBar, .mx_EvenTile_line .mx_MessageActionBar,
@ -104,6 +109,10 @@ $right-padding: 5px;
.mx_EventTile_reply { .mx_EventTile_reply {
order: 3; order: 3;
} }
.mx_EditMessageComposer_buttons {
position: relative;
}
} }
.mx_EventListSummary { .mx_EventListSummary {
@ -144,4 +153,17 @@ $right-padding: 5px;
padding-left: 0; padding-left: 0;
border-left: 0; border-left: 0;
} }
.mx_SenderProfile_hover {
background-color: $primary-bg-color;
overflow: hidden;
width: $name-width;
transition: width 2s;
}
.mx_SenderProfile_hover:hover {
overflow: visible;
width: auto;
z-index: 10;
}
} }

View file

@ -117,7 +117,8 @@ export default class MessagePanel extends React.Component {
// display 'ghost' read markers that are animating away // display 'ghost' read markers that are animating away
ghostReadMarkers: [], ghostReadMarkers: [],
showTypingNotifications: SettingsStore.getValue("showTypingNotifications"), showTypingNotifications: SettingsStore.getValue("showTypingNotifications"),
useIRCLayout: SettingsStore.getValue("useIRCLayout"), useIRCLayout: SettingsStore.getValue("feature_irc_ui"),
displayAvatars: SettingsStore.getValue("feature_no_timeline_avatars"),
}; };
// opaque readreceipt info for each userId; used by ReadReceiptMarker // opaque readreceipt info for each userId; used by ReadReceiptMarker
@ -171,7 +172,8 @@ export default class MessagePanel extends React.Component {
this._showTypingNotificationsWatcherRef = this._showTypingNotificationsWatcherRef =
SettingsStore.watchSetting("showTypingNotifications", null, this.onShowTypingNotificationsChange); SettingsStore.watchSetting("showTypingNotifications", null, this.onShowTypingNotificationsChange);
this._layoutWatcherRef = SettingsStore.watchSetting("useIRCLayout", null, this.onLayoutChange); this._layoutWatcherRef = SettingsStore.watchSetting("feature_irc_ui", null, this.onLayoutChange);
this._displayAvatarsWatcherRef = SettingsStore.watchSetting("feature_no_timeline_avatars", null, this.onDisplayAvatarsChange);
} }
componentDidMount() { componentDidMount() {
@ -182,6 +184,7 @@ export default class MessagePanel extends React.Component {
this._isMounted = false; this._isMounted = false;
SettingsStore.unwatchSetting(this._showTypingNotificationsWatcherRef); SettingsStore.unwatchSetting(this._showTypingNotificationsWatcherRef);
SettingsStore.unwatchSetting(this._layoutWatcherRef); SettingsStore.unwatchSetting(this._layoutWatcherRef);
SettingsStore.unwatchSetting(this._displayAvatarsWatcherRef);
} }
componentDidUpdate(prevProps, prevState) { componentDidUpdate(prevProps, prevState) {
@ -202,7 +205,13 @@ export default class MessagePanel extends React.Component {
onLayoutChange = () => { onLayoutChange = () => {
this.setState({ this.setState({
useIRCLayout: SettingsStore.getValue("useIRCLayout"), useIRCLayout: SettingsStore.getValue("feature_irc_ui"),
});
}
onDisplayAvatarsChange = () => {
this.setState({
displayAvatars: SettingsStore.getValue("feature_no_timeline_avatars"),
}); });
} }
@ -608,6 +617,7 @@ export default class MessagePanel extends React.Component {
getRelationsForEvent={this.props.getRelationsForEvent} getRelationsForEvent={this.props.getRelationsForEvent}
showReactions={this.props.showReactions} showReactions={this.props.showReactions}
useIRCLayout={this.state.useIRCLayout} useIRCLayout={this.state.useIRCLayout}
displayAvatars={this.state.displayAvatars}
/> />
</TileErrorBoundary> </TileErrorBoundary>
</li>, </li>,

View file

@ -39,6 +39,8 @@ export default class ReplyThread extends React.Component {
permalinkCreator: PropTypes.instanceOf(RoomPermalinkCreator).isRequired, permalinkCreator: PropTypes.instanceOf(RoomPermalinkCreator).isRequired,
// Specifies which layout to use. // Specifies which layout to use.
useIRCLayout: PropTypes.bool, useIRCLayout: PropTypes.bool,
// Specifies whether to display avatars.
displayAvatars: PropTypes.bool,
}; };
static contextType = MatrixClientContext; static contextType = MatrixClientContext;
@ -178,12 +180,12 @@ export default class ReplyThread extends React.Component {
}; };
} }
static makeThread(parentEv, onHeightChanged, permalinkCreator, ref, useIRCLayout) { static makeThread(parentEv, onHeightChanged, permalinkCreator, ref, useIRCLayout, displayAvatars) {
if (!ReplyThread.getParentEventId(parentEv)) { if (!ReplyThread.getParentEventId(parentEv)) {
return <div className="mx_ReplyThread_wrapper_empty" />; return <div className="mx_ReplyThread_wrapper_empty" />;
} }
return <ReplyThread parentEv={parentEv} onHeightChanged={onHeightChanged} return <ReplyThread parentEv={parentEv} onHeightChanged={onHeightChanged}
ref={ref} permalinkCreator={permalinkCreator} useIRCLayout={useIRCLayout} />; ref={ref} permalinkCreator={permalinkCreator} useIRCLayout={useIRCLayout} displayAvatars={displayAvatars} />;
} }
componentDidMount() { componentDidMount() {
@ -334,7 +336,9 @@ export default class ReplyThread extends React.Component {
permalinkCreator={this.props.permalinkCreator} permalinkCreator={this.props.permalinkCreator}
isRedacted={ev.isRedacted()} isRedacted={ev.isRedacted()}
isTwelveHour={SettingsStore.getValue("showTwelveHourTimestamps")} isTwelveHour={SettingsStore.getValue("showTwelveHourTimestamps")}
useIRCLayout={this.props.useIRCLayout} /> useIRCLayout={this.props.useIRCLayout}
displayAvatars={this.props.displayAvatars}
/>
</blockquote>; </blockquote>;
}); });

View file

@ -131,7 +131,10 @@ export default createReactClass({
return ( return (
<div className="mx_SenderProfile" dir="auto" onClick={this.props.onClick}> <div className="mx_SenderProfile" dir="auto" onClick={this.props.onClick}>
<div className="mx_SenderProfile_hover">
{ content }
{ content } { content }
</div>
</div> </div>
); );
}, },

View file

@ -209,6 +209,9 @@ export default createReactClass({
// whether to use the irc layout // whether to use the irc layout
useIRCLayout: PropTypes.bool, useIRCLayout: PropTypes.bool,
// whether to display avatars
displayAvatars: PropTypes.bool,
}, },
getDefaultProps: function() { getDefaultProps: function() {
@ -713,7 +716,7 @@ export default createReactClass({
needsSenderProfile = true; needsSenderProfile = true;
} }
if (this.props.mxEvent.sender && avatarSize) { if (this.props.mxEvent.sender && avatarSize && this.props.displayAvatars) {
avatar = ( avatar = (
<div className="mx_EventTile_avatar"> <div className="mx_EventTile_avatar">
<MemberAvatar member={this.props.mxEvent.sender} <MemberAvatar member={this.props.mxEvent.sender}
@ -897,6 +900,7 @@ export default createReactClass({
this.props.permalinkCreator, this.props.permalinkCreator,
this._replyThread, this._replyThread,
this.props.useIRCLayout, this.props.useIRCLayout,
this.props.displayAvatars,
); );
// tab-index=-1 to allow it to be focusable but do not add tab stop for it, primarily for screen readers // tab-index=-1 to allow it to be focusable but do not add tab stop for it, primarily for screen readers

View file

@ -409,6 +409,7 @@
"Show info about bridges in room settings": "Show info about bridges in room settings", "Show info about bridges in room settings": "Show info about bridges in room settings",
"Enable Emoji suggestions while typing": "Enable Emoji suggestions while typing", "Enable Emoji suggestions while typing": "Enable Emoji suggestions while typing",
"Use IRC layout": "Use IRC layout", "Use IRC layout": "Use IRC layout",
"Display user avatars on messages": "Display user avatars on messages",
"Use compact timeline layout": "Use compact timeline layout", "Use compact timeline layout": "Use compact timeline layout",
"Show a placeholder for removed messages": "Show a placeholder for removed messages", "Show a placeholder for removed messages": "Show a placeholder for removed messages",
"Show join/leave messages (invites/kicks/bans unaffected)": "Show join/leave messages (invites/kicks/bans unaffected)", "Show join/leave messages (invites/kicks/bans unaffected)": "Show join/leave messages (invites/kicks/bans unaffected)",

View file

@ -143,6 +143,18 @@ export const SETTINGS = {
supportedLevels: LEVELS_FEATURE, supportedLevels: LEVELS_FEATURE,
default: false, default: false,
}, },
"feature_irc_ui": {
supportedLevels: LEVELS_ACCOUNT_SETTINGS,
displayName: _td('Use IRC layout'),
default: false,
isFeature: true,
},
"feature_no_timeline_avatars": {
supportedLevels: LEVELS_ACCOUNT_SETTINGS,
displayName: _td('Display user avatars on messages'),
default: true,
isFeature: true,
},
"mjolnirRooms": { "mjolnirRooms": {
supportedLevels: ['account'], supportedLevels: ['account'],
default: [], default: [],
@ -170,11 +182,6 @@ export const SETTINGS = {
default: true, default: true,
invertedSettingName: 'MessageComposerInput.dontSuggestEmoji', invertedSettingName: 'MessageComposerInput.dontSuggestEmoji',
}, },
"useIRCLayout": {
supportedLevels: LEVELS_ACCOUNT_SETTINGS,
displayName: _td('Use IRC layout'),
default: false,
},
"useCompactLayout": { "useCompactLayout": {
supportedLevels: LEVELS_ACCOUNT_SETTINGS, supportedLevels: LEVELS_ACCOUNT_SETTINGS,
displayName: _td('Use compact timeline layout'), displayName: _td('Use compact timeline layout'),