Clearly show when an user cannot join a room.
In realtime show who kicked or banned him.
This commit is contained in:
parent
fb082cf50f
commit
ceec607e7f
|
@ -27,6 +27,7 @@ angular.module('RoomController', ['ngSanitize', 'matrixFilter', 'mFileInput'])
|
||||||
|
|
||||||
$scope.state = {
|
$scope.state = {
|
||||||
user_id: matrixService.config().user_id,
|
user_id: matrixService.config().user_id,
|
||||||
|
permission_denied: undefined, // If defined, this string contains the reason why the user cannot join the room
|
||||||
first_pagination: true, // this is toggled off when the first pagination is done
|
first_pagination: true, // this is toggled off when the first pagination is done
|
||||||
can_paginate: false, // this is toggled off when we are not ready yet to paginate or when we run out of items
|
can_paginate: false, // this is toggled off when we are not ready yet to paginate or when we run out of items
|
||||||
paginating: false, // used to avoid concurrent pagination requests pulling in dup contents
|
paginating: false, // used to avoid concurrent pagination requests pulling in dup contents
|
||||||
|
@ -129,6 +130,28 @@ angular.module('RoomController', ['ngSanitize', 'matrixFilter', 'mFileInput'])
|
||||||
$scope.state.waiting_for_joined_event = false;
|
$scope.state.waiting_for_joined_event = false;
|
||||||
onInit3();
|
onInit3();
|
||||||
}
|
}
|
||||||
|
else if (event.state_key === $scope.state.user_id && "invite" !== event.membership && "join" !== event.membership) {
|
||||||
|
var user;
|
||||||
|
|
||||||
|
if ($scope.members[event.user_id]) {
|
||||||
|
user = $scope.members[event.user_id].displayname;
|
||||||
|
}
|
||||||
|
if (user) {
|
||||||
|
user = user + " (" + event.user_id + ")";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
user = event.user_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ("ban" === event.membership) {
|
||||||
|
$scope.state.permission_denied = "You have been banned by " + user;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$scope.state.permission_denied = "You have been kicked by " + user;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
scrollToBottom();
|
scrollToBottom();
|
||||||
updateMemberList(event);
|
updateMemberList(event);
|
||||||
|
@ -654,7 +677,7 @@ angular.module('RoomController', ['ngSanitize', 'matrixFilter', 'mFileInput'])
|
||||||
},
|
},
|
||||||
function(reason) {
|
function(reason) {
|
||||||
console.log("Can't join room: " + JSON.stringify(reason));
|
console.log("Can't join room: " + JSON.stringify(reason));
|
||||||
$scope.feedback = "You do not have permission to join this room";
|
$scope.state.permission_denied = "You do not have permission to join this room";
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
<div ng-include="'recents/recents.html'"></div>
|
<div ng-include="'recents/recents.html'"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="usersTableWrapper">
|
<div id="usersTableWrapper" ng-hide="state.permission_denied">
|
||||||
<table id="usersTable">
|
<table id="usersTable">
|
||||||
<tr ng-repeat="member in members | orderMembersList">
|
<tr ng-repeat="member in members | orderMembersList">
|
||||||
<td class="userAvatar mouse-pointer" ng-click="$parent.goToUserPage(member.id)" ng-class="member.membership == 'invite' ? 'invited' : ''">
|
<td class="userAvatar mouse-pointer" ng-click="$parent.goToUserPage(member.id)" ng-class="member.membership == 'invite' ? 'invited' : ''">
|
||||||
|
@ -49,7 +49,7 @@
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="messageTableWrapper" keep-scroll>
|
<div id="messageTableWrapper" ng-hide="state.permission_denied" keep-scroll>
|
||||||
<!-- FIXME: need to have better timestamp semantics than the (msg.content.hsob_ts || msg.ts) hack below -->
|
<!-- FIXME: need to have better timestamp semantics than the (msg.content.hsob_ts || msg.ts) hack below -->
|
||||||
<table id="messageTable" infinite-scroll="paginateMore()">
|
<table id="messageTable" infinite-scroll="paginateMore()">
|
||||||
<tr ng-repeat="msg in events.rooms[room_id].messages"
|
<tr ng-repeat="msg in events.rooms[room_id].messages"
|
||||||
|
@ -127,6 +127,10 @@
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div ng-show="state.permission_denied">
|
||||||
|
{{ state.permission_denied }}
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -139,11 +143,13 @@
|
||||||
{{ state.user_id }}
|
{{ state.user_id }}
|
||||||
</td>
|
</td>
|
||||||
<td width="*">
|
<td width="*">
|
||||||
<textarea id="mainInput" rows="1" ng-model="textInput" ng-enter="send()" ng-focus="true" autocomplete="off" tab-complete/>
|
<textarea id="mainInput" rows="1" ng-model="textInput" ng-enter="send()"
|
||||||
|
ng-disabled="state.permission_denied"
|
||||||
|
ng-focus="true" autocomplete="off" tab-complete/>
|
||||||
</td>
|
</td>
|
||||||
<td id="buttonsCell">
|
<td id="buttonsCell">
|
||||||
<button ng-click="send()">Send</button>
|
<button ng-click="send()" ng-disabled="state.permission_denied">Send</button>
|
||||||
<button m-file-input="imageFileToSend" class="extraControls">Image</button>
|
<button m-file-input="imageFileToSend" class="extraControls" ng-disabled="state.permission_denied">Image</button>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
@ -151,11 +157,11 @@
|
||||||
<div class="extraControls">
|
<div class="extraControls">
|
||||||
<span>
|
<span>
|
||||||
Invite a user:
|
Invite a user:
|
||||||
<input ng-model="userIDToInvite" size="32" type="text" ng-enter="inviteUser()" placeholder="User ID (ex:@user:homeserver)"/>
|
<input ng-model="userIDToInvite" size="32" type="text" ng-enter="inviteUser()" ng-disabled="state.permission_denied" placeholder="User ID (ex:@user:homeserver)"/>
|
||||||
<button ng-click="inviteUser()">Invite</button>
|
<button ng-click="inviteUser()" ng-disabled="state.permission_denied">Invite</button>
|
||||||
</span>
|
</span>
|
||||||
<button ng-click="leaveRoom()">Leave</button>
|
<button ng-click="leaveRoom()" ng-disabled="state.permission_denied">Leave</button>
|
||||||
<button ng-click="startVoiceCall()" ng-show="(currentCall == undefined || currentCall.state == 'ended') && memberCount() == 2">Voice Call</button>
|
<button ng-click="startVoiceCall()" ng-show="(currentCall == undefined || currentCall.state == 'ended') && memberCount() == 2" ng-disabled="state.permission_denied">Voice Call</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{ feedback }}
|
{{ feedback }}
|
||||||
|
|
Loading…
Reference in New Issue