Merge pull request #3821 from matrix-org/zip/11226-padlock-icons
Display a padlock icon beside invite-only rooms (excluding DMs) in the room list
This commit is contained in:
commit
edd08c279c
3 changed files with 48 additions and 2 deletions
|
@ -200,3 +200,31 @@ limitations under the License.
|
||||||
.mx_GroupInviteTile .mx_RoomTile_name {
|
.mx_GroupInviteTile .mx_RoomTile_name {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.mx_RoomTile.mx_RoomTile.mx_RoomTile_isPrivate .mx_RoomTile_name {
|
||||||
|
// Scoot the padding in a bit from 6px to make it look better
|
||||||
|
padding-left: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mx_RoomTile.mx_RoomTile_isPrivate .mx_RoomTile_PrivateIcon {
|
||||||
|
width: 12px;
|
||||||
|
height: 12px;
|
||||||
|
position: relative;
|
||||||
|
display: block !important;
|
||||||
|
// Align the padlock with unencrypted room names
|
||||||
|
margin-left: 6px;
|
||||||
|
|
||||||
|
&::before {
|
||||||
|
background-color: $roomtile-name-color;
|
||||||
|
mask-image: url('$(res)/img/feather-customised/lock-solid.svg');
|
||||||
|
mask-position: center;
|
||||||
|
mask-repeat: no-repeat;
|
||||||
|
mask-size: contain;
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
4
res/img/feather-customised/lock-solid.svg
Normal file
4
res/img/feather-customised/lock-solid.svg
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M3 13C3 11.8954 3.89543 11 5 11H19C20.1046 11 21 11.8954 21 13V20C21 21.1046 20.1046 22 19 22H5C3.89543 22 3 21.1046 3 20V13Z" fill="#2E2F32" stroke="#2E2F32" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
|
<path d="M7 11V7C7 4.23858 9.23858 2 12 2C14.7614 2 17 4.23858 17 7V11" stroke="#2E2F32" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 532 B |
|
@ -56,7 +56,11 @@ module.exports = createReactClass({
|
||||||
},
|
},
|
||||||
|
|
||||||
getInitialState: function() {
|
getInitialState: function() {
|
||||||
|
const joinRules = this.props.room.currentState.getStateEvents("m.room.join_rules", "");
|
||||||
|
const joinRule = joinRules && joinRules.getContent().join_rule;
|
||||||
|
|
||||||
return ({
|
return ({
|
||||||
|
joinRule,
|
||||||
hover: false,
|
hover: false,
|
||||||
badgeHover: false,
|
badgeHover: false,
|
||||||
contextMenuPosition: null, // DOM bounding box, null if non-shown
|
contextMenuPosition: null, // DOM bounding box, null if non-shown
|
||||||
|
@ -104,6 +108,12 @@ module.exports = createReactClass({
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onJoinRule: function(ev) {
|
||||||
|
if (ev.getType() !== "m.room.join_rules") return;
|
||||||
|
if (ev.getRoomId() !== this.props.room.roomId) return;
|
||||||
|
this.setState({ joinRule: ev.getContent().join_rule });
|
||||||
|
},
|
||||||
|
|
||||||
onAccountData: function(accountDataEvent) {
|
onAccountData: function(accountDataEvent) {
|
||||||
if (accountDataEvent.getType() === 'm.push_rules') {
|
if (accountDataEvent.getType() === 'm.push_rules') {
|
||||||
this.setState({
|
this.setState({
|
||||||
|
@ -143,6 +153,7 @@ module.exports = createReactClass({
|
||||||
const cli = MatrixClientPeg.get();
|
const cli = MatrixClientPeg.get();
|
||||||
cli.on("accountData", this.onAccountData);
|
cli.on("accountData", this.onAccountData);
|
||||||
cli.on("Room.name", this.onRoomName);
|
cli.on("Room.name", this.onRoomName);
|
||||||
|
cli.on("RoomState.events", this.onJoinRule);
|
||||||
ActiveRoomObserver.addListener(this.props.room.roomId, this._onActiveRoomChange);
|
ActiveRoomObserver.addListener(this.props.room.roomId, this._onActiveRoomChange);
|
||||||
this.dispatcherRef = dis.register(this.onAction);
|
this.dispatcherRef = dis.register(this.onAction);
|
||||||
|
|
||||||
|
@ -159,6 +170,7 @@ module.exports = createReactClass({
|
||||||
if (cli) {
|
if (cli) {
|
||||||
MatrixClientPeg.get().removeListener("accountData", this.onAccountData);
|
MatrixClientPeg.get().removeListener("accountData", this.onAccountData);
|
||||||
MatrixClientPeg.get().removeListener("Room.name", this.onRoomName);
|
MatrixClientPeg.get().removeListener("Room.name", this.onRoomName);
|
||||||
|
cli.removeListener("RoomState.events", this.onJoinRule);
|
||||||
}
|
}
|
||||||
ActiveRoomObserver.removeListener(this.props.room.roomId, this._onActiveRoomChange);
|
ActiveRoomObserver.removeListener(this.props.room.roomId, this._onActiveRoomChange);
|
||||||
dis.unregister(this.dispatcherRef);
|
dis.unregister(this.dispatcherRef);
|
||||||
|
@ -292,6 +304,8 @@ module.exports = createReactClass({
|
||||||
|
|
||||||
const isMenuDisplayed = Boolean(this.state.contextMenuPosition);
|
const isMenuDisplayed = Boolean(this.state.contextMenuPosition);
|
||||||
|
|
||||||
|
const dmUserId = DMRoomMap.shared().getUserIdForRoomId(this.props.room.roomId);
|
||||||
|
|
||||||
const classes = classNames({
|
const classes = classNames({
|
||||||
'mx_RoomTile': true,
|
'mx_RoomTile': true,
|
||||||
'mx_RoomTile_selected': this.state.selected,
|
'mx_RoomTile_selected': this.state.selected,
|
||||||
|
@ -303,6 +317,7 @@ module.exports = createReactClass({
|
||||||
'mx_RoomTile_noBadges': !badges,
|
'mx_RoomTile_noBadges': !badges,
|
||||||
'mx_RoomTile_transparent': this.props.transparent,
|
'mx_RoomTile_transparent': this.props.transparent,
|
||||||
'mx_RoomTile_hasSubtext': subtext && !this.props.collapsed,
|
'mx_RoomTile_hasSubtext': subtext && !this.props.collapsed,
|
||||||
|
'mx_RoomTile_isPrivate': this.state.joinRule == "invite" && !dmUserId,
|
||||||
});
|
});
|
||||||
|
|
||||||
const avatarClasses = classNames({
|
const avatarClasses = classNames({
|
||||||
|
@ -366,8 +381,6 @@ module.exports = createReactClass({
|
||||||
|
|
||||||
let ariaLabel = name;
|
let ariaLabel = name;
|
||||||
|
|
||||||
const dmUserId = DMRoomMap.shared().getUserIdForRoomId(this.props.room.roomId);
|
|
||||||
|
|
||||||
let dmIndicator;
|
let dmIndicator;
|
||||||
let dmOnline;
|
let dmOnline;
|
||||||
if (dmUserId) {
|
if (dmUserId) {
|
||||||
|
@ -428,6 +441,7 @@ module.exports = createReactClass({
|
||||||
{ dmIndicator }
|
{ dmIndicator }
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div className="mx_RoomTile_PrivateIcon" />
|
||||||
<div className="mx_RoomTile_nameContainer">
|
<div className="mx_RoomTile_nameContainer">
|
||||||
<div className="mx_RoomTile_labelContainer">
|
<div className="mx_RoomTile_labelContainer">
|
||||||
{ label }
|
{ label }
|
||||||
|
|
Loading…
Reference in a new issue