0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-12-15 00:03:51 +01:00

Use $location.url instead of $location.path to get clean page URL without hash arguments of the previous page.

This happpens with room URL like http://127.0.0.1:8080/matrix/client/#/room/#public:localhost. The second hash part is transferred to the next page when using $location.path.
This commit is contained in:
Emmanuel ROHEE 2014-08-22 11:43:54 +02:00
parent acf5127604
commit dde50d4245
4 changed files with 10 additions and 10 deletions

View file

@ -66,7 +66,7 @@ angular.module('MatrixWebClientController', ['matrixService'])
matrixService.saveConfig(); matrixService.saveConfig();
// And go to the login page // And go to the login page
$location.path("login"); $location.url("login");
}; };
// Listen to the event indicating that the access token is no longer valid. // Listen to the event indicating that the access token is no longer valid.

View file

@ -53,7 +53,7 @@ angular.module('LoginController', ['matrixService'])
matrixService.saveConfig(); matrixService.saveConfig();
eventStreamService.resume(); eventStreamService.resume();
// Go to the user's rooms list page // Go to the user's rooms list page
$location.path("rooms"); $location.url("rooms");
}, },
function(error) { function(error) {
if (error.data) { if (error.data) {
@ -84,7 +84,7 @@ angular.module('LoginController', ['matrixService'])
}); });
matrixService.saveConfig(); matrixService.saveConfig();
eventStreamService.resume(); eventStreamService.resume();
$location.path("rooms"); $location.url("rooms");
} }
else { else {
$scope.feedback = "Failed to login: " + JSON.stringify(response.data); $scope.feedback = "Failed to login: " + JSON.stringify(response.data);

View file

@ -293,7 +293,7 @@ angular.module('RoomController', ['ngSanitize', 'mUtilities'])
else { else {
// In case of issue, go to the default page // In case of issue, go to the default page
console.log("Error: cannot extract room alias"); console.log("Error: cannot extract room alias");
$location.path("/"); $location.url("/");
return; return;
} }
} }
@ -310,7 +310,7 @@ angular.module('RoomController', ['ngSanitize', 'mUtilities'])
function () { function () {
// In case of issue, go to the default page // In case of issue, go to the default page
console.log("Error: cannot resolve room alias"); console.log("Error: cannot resolve room alias");
$location.path("/"); $location.url("/");
}); });
} }
}; };
@ -364,7 +364,7 @@ angular.module('RoomController', ['ngSanitize', 'mUtilities'])
matrixService.leave($scope.room_id).then( matrixService.leave($scope.room_id).then(
function(response) { function(response) {
console.log("Left room "); console.log("Left room ");
$location.path("rooms"); $location.url("rooms");
}, },
function(error) { function(error) {
$scope.feedback = "Failed to leave room: " + error.data.error; $scope.feedback = "Failed to leave room: " + error.data.error;

View file

@ -141,17 +141,17 @@ angular.module('RoomsController', ['matrixService', 'mFileInput', 'mFileUpload',
// Go to a room // Go to a room
$scope.goToRoom = function(room_id) { $scope.goToRoom = function(room_id) {
// Simply open the room page on this room id // Simply open the room page on this room id
//$location.path("room/" + room_id); //$location.url("room/" + room_id);
matrixService.join(room_id).then( matrixService.join(room_id).then(
function(response) { function(response) {
if (response.data.hasOwnProperty("room_id")) { if (response.data.hasOwnProperty("room_id")) {
if (response.data.room_id != room_id) { if (response.data.room_id != room_id) {
$location.path("room/" + response.data.room_id); $location.url("room/" + response.data.room_id);
return; return;
} }
} }
$location.path("room/" + room_id); $location.url("room/" + room_id);
}, },
function(error) { function(error) {
$scope.feedback = "Can't join room: " + error.data; $scope.feedback = "Can't join room: " + error.data;
@ -163,7 +163,7 @@ angular.module('RoomsController', ['matrixService', 'mFileInput', 'mFileUpload',
matrixService.joinAlias(room_alias).then( matrixService.joinAlias(room_alias).then(
function(response) { function(response) {
// Go to this room // Go to this room
$location.path("room/" + room_alias); $location.url("room/" + room_alias);
}, },
function(error) { function(error) {
$scope.feedback = "Can't join room: " + error.data; $scope.feedback = "Can't join room: " + error.data;