Fix ability to invite users. Remove unused variables.

This commit is contained in:
Kegan Dougal 2014-11-12 17:06:03 +00:00
parent f04b3d5042
commit f4a3b194da
2 changed files with 17 additions and 27 deletions

View File

@ -22,14 +22,7 @@ angular.module('RoomController', ['ngSanitize', 'matrixFilter', 'mFileInput', 'a
var THUMBNAIL_SIZE = 320; var THUMBNAIL_SIZE = 320;
// .html needs this // .html needs this
$scope.containsBingWord = function(content) { $scope.containsBingWord = eventHandlerService.eventContainsBingWord;
return notificationService.containsBingWord(
matrixService.config().user_id,
matrixService.config().display_name,
matrixService.config().bingWords,
content
);
};
// Room ids. Computed and resolved in onInit // Room ids. Computed and resolved in onInit
$scope.room_id = undefined; $scope.room_id = undefined;
@ -46,12 +39,8 @@ angular.module('RoomController', ['ngSanitize', 'matrixFilter', 'mFileInput', 'a
messages_visibility: "hidden", // In order to avoid flickering when scrolling down the message table at the page opening, delay the message table display messages_visibility: "hidden", // In order to avoid flickering when scrolling down the message table at the page opening, delay the message table display
}; };
$scope.members = {}; $scope.members = {};
$scope.autoCompleting = false;
$scope.autoCompleteIndex = 0;
$scope.autoCompleteOriginal = "";
$scope.imageURLToSend = ""; $scope.imageURLToSend = "";
$scope.userIDToInvite = "";
// vars and functions for updating the name // vars and functions for updating the name
@ -162,7 +151,6 @@ angular.module('RoomController', ['ngSanitize', 'matrixFilter', 'mFileInput', 'a
$scope.$on(eventHandlerService.MSG_EVENT, function(ngEvent, event, isLive) { $scope.$on(eventHandlerService.MSG_EVENT, function(ngEvent, event, isLive) {
if (isLive && event.room_id === $scope.room_id) { if (isLive && event.room_id === $scope.room_id) {
scrollToBottom(); scrollToBottom();
} }
}); });
@ -841,19 +829,6 @@ angular.module('RoomController', ['ngSanitize', 'matrixFilter', 'mFileInput', 'a
} }
); );
}; };
$scope.inviteUser = function() {
matrixService.invite($scope.room_id, $scope.userIDToInvite).then(
function() {
console.log("Invited.");
$scope.feedback = "Invite successfully sent to " + $scope.userIDToInvite;
$scope.userIDToInvite = "";
},
function(reason) {
$scope.feedback = "Failure: " + reason.data.error;
});
};
$scope.leaveRoom = function() { $scope.leaveRoom = function() {
@ -1091,6 +1066,21 @@ angular.module('RoomController', ['ngSanitize', 'matrixFilter', 'mFileInput', 'a
}) })
.controller('RoomInfoController', function($scope, $modalInstance, $filter, matrixService) { .controller('RoomInfoController', function($scope, $modalInstance, $filter, matrixService) {
console.log("Displaying room info."); console.log("Displaying room info.");
$scope.userIDToInvite = "";
$scope.inviteUser = function() {
matrixService.invite($scope.room_id, $scope.userIDToInvite).then(
function() {
console.log("Invited.");
$scope.feedback = "Invite successfully sent to " + $scope.userIDToInvite;
$scope.userIDToInvite = "";
},
function(reason) {
$scope.feedback = "Failure: " + reason.data.error;
});
};
$scope.submit = function(event) { $scope.submit = function(event) {
if (event.content) { if (event.content) {

View File

@ -203,7 +203,7 @@
<span ng-show='msg.content.msgtype === "m.text"' <span ng-show='msg.content.msgtype === "m.text"'
class="message" class="message"
ng-class="containsBingWord(msg.content.body) && msg.user_id != state.user_id ? msg.echo_msg_state + ' messageBing' : msg.echo_msg_state" ng-class="containsBingWord(msg) && msg.user_id != state.user_id ? msg.echo_msg_state + ' messageBing' : msg.echo_msg_state"
ng-bind-html="(msg.content.msgtype === 'm.text' && msg.type === 'm.room.message' && msg.content.format === 'org.matrix.custom.html') ? ng-bind-html="(msg.content.msgtype === 'm.text' && msg.type === 'm.room.message' && msg.content.format === 'org.matrix.custom.html') ?
(msg.content.formatted_body | unsanitizedLinky) : (msg.content.formatted_body | unsanitizedLinky) :
(msg.content.msgtype === 'm.text' && msg.type === 'm.room.message') ? (msg.content.body | linky:'_blank') : '' "/> (msg.content.msgtype === 'm.text' && msg.type === 'm.room.message') ? (msg.content.body | linky:'_blank') : '' "/>