Actually, this task was about join rules, not encryption ones. Oops.

pull/21833/head
Zoe 2020-01-10 16:33:08 +00:00
parent cb250c9b10
commit 5551b207c1
2 changed files with 17 additions and 4 deletions

View File

@ -201,12 +201,12 @@ limitations under the License.
flex: 1; flex: 1;
} }
.mx_RoomTile.mx_RoomTile.mx_RoomTile_isEncrypted .mx_RoomTile_name { .mx_RoomTile.mx_RoomTile.mx_RoomTile_isPrivate .mx_RoomTile_name {
// Scoot the padding in a bit from 6px to make it look better // Scoot the padding in a bit from 6px to make it look better
padding-left: 3px; padding-left: 3px;
} }
.mx_RoomTile.mx_RoomTile_isEncrypted .mx_RoomTile_E2EIcon { .mx_RoomTile.mx_RoomTile_isPrivate .mx_RoomTile_PrivateIcon {
width: 12px; width: 12px;
height: 12px; height: 12px;
position: relative; position: relative;

View File

@ -56,7 +56,10 @@ module.exports = createReactClass({
}, },
getInitialState: function() { getInitialState: function() {
const { event: { content: { join_rule } } } = this.props.room.currentState.getStateEvents("m.room.join_rules", "");
return ({ return ({
join_rule,
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 +107,14 @@ module.exports = createReactClass({
}); });
}, },
onJoinRule: function(ev) {
const { event: { type, room_id } } = ev;
if (type !== "m.room.join_rules") return;
if (room_id !== this.props.room.roomId) return;
const { event: { content: { join_rule } } } = ev;
this.setState({ 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 +154,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 +171,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);
@ -303,7 +316,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_isEncrypted': Boolean(this.props.room.currentState.getStateEvents("m.room.encryption", "")), 'mx_RoomTile_isPrivate': this.state.join_rule == "invite",
}); });
const avatarClasses = classNames({ const avatarClasses = classNames({
@ -429,7 +442,7 @@ module.exports = createReactClass({
{ dmIndicator } { dmIndicator }
</div> </div>
</div> </div>
<div className="mx_RoomTile_E2EIcon" /> <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 }