summary refs log tree commit diff
path: root/webclient/recents/recents.html
blob: 6976bab879e4aed0b1f0a746a31fddb8fe5f8117 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<div ng-controller="RecentsController" data-ng-init="onInit()">
    <table class="recentsTable">
        <tbody ng-repeat="(rm_id, room) in 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>
                </td>
                <td class="recentsRoomSummaryTS">
                    {{ (room.lastMsg.ts) | date:'MMM d HH:mm' }}
                </td>
            </tr>

            <tr>
                <td colspan="3" class="recentsRoomSummary">

                    <div ng-show="room.membership === 'invite'">
                        {{ room.lastMsg.inviter | mUserDisplayName: room.room_id }} invited you
                    </div>
                    
                    <div ng-hide="room.membership === 'invite'" ng-switch="room.lastMsg.type">
                        <div ng-switch-when="m.room.member">
                            <span ng-if="'join' === room.lastMsg.content.membership">
                                {{ room.lastMsg.state_key | mUserDisplayName: room.room_id}} joined
                            </span>
                            <span ng-if="'leave' === room.lastMsg.content.membership">
                                <span ng-if="room.lastMsg.user_id === room.lastMsg.state_key">
                                    {{room.lastMsg.state_key | mUserDisplayName: room.room_id }} left
                                </span>
                                <span ng-if="room.lastMsg.user_id !== room.lastMsg.state_key">
                                    {{ room.lastMsg.user_id | mUserDisplayName: room.room_id }}
                                    {{ {"join": "kicked", "ban": "unbanned"}[room.lastMsg.content.prev] }}
                                    {{ room.lastMsg.state_key | mUserDisplayName: room.room_id }}
                                </span>
                                <span ng-if="'join' === room.lastMsg.content.prev && room.lastMsg.content.reason">
                                    : {{ room.lastMsg.content.reason }}
                                </span>
                            </span>
                            <span ng-if="'invite' === room.lastMsg.content.membership || 'ban' === room.lastMsg.content.membership">
                                {{ room.lastMsg.user_id | mUserDisplayName: room.room_id }}
                                {{ {"invite": "invited", "ban": "banned"}[room.lastMsg.content.membership] }}
                                {{ room.lastMsg.state_key | mUserDisplayName: room.room_id }}
                                <span ng-if="'ban' === room.lastMsg.content.prev && room.lastMsg.content.reason">
                                    : {{ room.lastMsg.content.reason }}
                                </span>
                            </span>
                        </div>

                        <div ng-switch-when="m.room.message">
                            <div ng-switch="room.lastMsg.content.msgtype">
                                <div ng-switch-when="m.text">
                                    {{ room.lastMsg.user_id | mUserDisplayName: room.room_id }} :
                                    <span ng-bind-html="(room.lastMsg.content.body) | linky:'_blank'">
                                    </span>
                                </div>

                                <div ng-switch-when="m.image">
                                    {{ room.lastMsg.user_id | mUserDisplayName: room.room_id }} sent an image
                                </div>

                                <div ng-switch-when="m.emote">
                                    <span ng-bind-html="'* ' + (room.lastMsg.user_id) + ' ' + room.lastMsg.content.body | linky:'_blank'">
                                    </span>
                                </div>

                                <div ng-switch-default>
                                    {{ room.lastMsg.content }}
                                </div>
                            </div>
                        </div>

                        <div ng-switch-when="m.room.topic">
                            {{ room.lastMsg.user_id | mUserDisplayName: room.room_id }} changed the topic to: {{ room.lastMsg.content.topic }}
                        </div>

                        <div ng-switch-default>
                            <div ng-if="room.lastMsg.type.indexOf('m.call.') === 0">
                                Call
                            </div>
                        </div>
                    </div>
                </td>
            </tr>
        </tbody>
    </table>
</div>