MatrixSynapse/webclient/recents/recents.html

102 lines
5.4 KiB
HTML
Raw Normal View History

<div ng-controller="RecentsController">
<table class="recentsTable">
<tbody ng-repeat="(index, room) in events.rooms | orderRecents"
ng-click="goToPage('room/' + (room.room_alias ? room.room_alias : room.room_id) )"
class ="recentsRoom"
ng-class="{'recentsRoomSelected': (room.room_id === recentsSelectedRoomID)}">
<tr>
<td class="recentsRoomName">
{{ room.room_id | mRoomName }}
</td>
<td class="recentsRoomSummaryTS">
<span ng-show="undefined !== room.numUsersInRoom">
{{ room.numUsersInRoom || '1' }} {{ room.numUsersInRoom == 1 ? 'user' : 'users' }}
</span>
2014-09-08 20:55:19 +02:00
</td>
<td class="recentsRoomSummaryTS">
<!-- Use a temp var as alias to the last room message.
Declaring it in this way ensures the data-binding -->
{{lastMsg = room.messages[room.messages.length - 1];""}}
{{ (lastMsg.ts) | date:'MMM d HH:mm' }}
</td>
</tr>
<tr>
<td colspan="3" class="recentsRoomSummary">
<div ng-show="room.membership === 'invite'">
{{ room.inviter | mUserDisplayName: room.room_id }} invited you
</div>
<div ng-hide="room.membership === 'invite'" ng-switch="lastMsg.type">
<div ng-switch-when="m.room.member">
<span ng-if="'join' === lastMsg.content.membership">
{{ lastMsg.state_key | mUserDisplayName: room.room_id}} joined
</span>
<span ng-if="'leave' === lastMsg.content.membership">
<span ng-if="lastMsg.user_id === lastMsg.state_key">
{{lastMsg.state_key | mUserDisplayName: room.room_id }} left
</span>
<span ng-if="lastMsg.user_id !== lastMsg.state_key">
{{ lastMsg.user_id | mUserDisplayName: room.room_id }}
{{ {"join": "kicked", "ban": "unbanned"}[lastMsg.content.prev] }}
{{ lastMsg.state_key | mUserDisplayName: room.room_id }}
</span>
<span ng-if="'join' === lastMsg.content.prev && lastMsg.content.reason">
: {{ lastMsg.content.reason }}
2014-09-05 16:45:59 +02:00
</span>
</span>
<span ng-if="'invite' === lastMsg.content.membership || 'ban' === lastMsg.content.membership">
{{ lastMsg.user_id | mUserDisplayName: room.room_id }}
{{ {"invite": "invited", "ban": "banned"}[lastMsg.content.membership] }}
{{ lastMsg.state_key | mUserDisplayName: room.room_id }}
<span ng-if="'ban' === lastMsg.content.prev && lastMsg.content.reason">
: {{ lastMsg.content.reason }}
2014-09-05 16:45:59 +02:00
</span>
</span>
</div>
<div ng-switch-when="m.room.message">
<div ng-switch="lastMsg.content.msgtype">
<div ng-switch-when="m.text">
{{ lastMsg.user_id | mUserDisplayName: room.room_id }} :
<span ng-bind-html="(lastMsg.content.body) | linky:'_blank'">
</span>
</div>
<div ng-switch-when="m.image">
{{ lastMsg.user_id | mUserDisplayName: room.room_id }} sent an image
</div>
2014-08-29 09:49:03 +02:00
<div ng-switch-when="m.emote">
<span ng-bind-html="'* ' + (lastMsg.user_id | mUserDisplayName: room.room_id) + ' ' + lastMsg.content.body | linky:'_blank'">
2014-08-29 09:49:03 +02:00
</span>
</div>
<div ng-switch-default>
{{ lastMsg.content }}
</div>
</div>
</div>
<div ng-switch-when="m.room.topic">
{{ lastMsg.user_id | mUserDisplayName: room.room_id }} changed the topic to: {{ lastMsg.content.topic }}
</div>
<div ng-switch-when="m.room.name">
{{ lastMsg.user_id | mUserDisplayName: room.room_id }} changed the room name to: {{ lastMsg.content.name }}
</div>
<div ng-switch-default>
<div ng-if="lastMsg.type.indexOf('m.call.') === 0">
Call
</div>
</div>
</div>
</td>
</tr>
</tbody>
</table>
</div>