WIP to support non-guest peeking, and slightly improve roomdirectory look & feel for now

This commit is contained in:
Matthew Hodgson 2016-01-18 17:37:13 +00:00
parent 0ef03c5ca4
commit d6f6f32c74
2 changed files with 21 additions and 9 deletions

View File

@ -72,6 +72,7 @@ module.exports = React.createClass({
joinOrPeekPromise.done(function() { joinOrPeekPromise.done(function() {
dis.dispatch({ dis.dispatch({
action: 'view_room', action: 'view_room',
auto_peek: false, // don't peek as we've already peeked here (if it was needed)
room_id: roomId room_id: roomId
}); });
}, function(err) { }, function(err) {
@ -97,7 +98,7 @@ module.exports = React.createClass({
}); });
var rows = []; var rows = [];
var self = this; var self = this;
var guestRead, guestJoin; var guestRead, guestJoin, perms;
for (var i = 0; i < rooms.length; i++) { for (var i = 0; i < rooms.length; i++) {
var name = rooms[i].name || rooms[i].aliases[0]; var name = rooms[i].name || rooms[i].aliases[0];
guestRead = null; guestRead = null;
@ -106,30 +107,37 @@ module.exports = React.createClass({
if (rooms[i].world_readable) { if (rooms[i].world_readable) {
guestRead = ( guestRead = (
<img src="img/members.svg" <span>[world readable]</span>
alt="World Readable" title="World Readable" width="12" height="12" />
); );
if (MatrixClientPeg.get().isGuest() && !rooms[i].guest_can_join) { // <img src="img/members.svg"
// alt="World Readable" title="World Readable" width="12" height="12" />
if (rooms[i].world_readable) {
shouldPeek = true; shouldPeek = true;
} }
} }
if (rooms[i].guest_can_join) { if (rooms[i].guest_can_join) {
guestJoin = ( guestJoin = (
<img src="img/leave.svg" <span>[guests allowed]</span>
alt="Guests can join" title="Guests can join" width="12" height="12" />
); );
// <img src="img/leave.svg"
// alt="Guests can join" title="Guests can join" width="12" height="12" />
}
perms = null;
if (guestRead || guestJoin) {
perms = <div>{guestRead} {guestJoin}</div>;
} }
// <img src={ MatrixClientPeg.get().getAvatarUrlForRoom(rooms[i].room_id, 40, 40, "crop") } width="40" height="40" alt=""/> // <img src={ MatrixClientPeg.get().getAvatarUrlForRoom(rooms[i].room_id, 40, 40, "crop") } width="40" height="40" alt=""/>
rows.unshift( rows.unshift(
<tbody key={ rooms[i].room_id }> <tbody key={ rooms[i].room_id }>
<tr onClick={self.joinRoom.bind(null, rooms[i].room_id, shouldPeek)}> <tr onClick={self.joinRoom.bind(null, rooms[i].room_id, shouldPeek)}>
<td className="mx_RoomDirectory_name">{ name } {guestRead} {guestJoin}</td> <td className="mx_RoomDirectory_name">{ name }</td>
<td>{ rooms[i].aliases[0] }</td> <td>{ rooms[i].aliases[0] }</td>
<td>{ rooms[i].num_joined_members }</td> <td>{ rooms[i].num_joined_members }</td>
</tr> </tr>
<tr> <tr onClick={self.joinRoom.bind(null, rooms[i].room_id, shouldPeek)}>
<td className="mx_RoomDirectory_topic" colSpan="3">{ rooms[i].topic }</td> <td className="mx_RoomDirectory_topic" colSpan="3">{perms} { rooms[i].topic }</td>
</tr> </tr>
</tbody> </tbody>
); );

View File

@ -22,6 +22,10 @@ limitations under the License.
color: #a4a4a4; color: #a4a4a4;
} }
.mx_RoomPreviewBar_invite_text {
color: #454545;
}
.mx_RoomPreviewBar_join_text { .mx_RoomPreviewBar_join_text {
color: #ff0064; color: #ff0064;
} }