mirror of
https://github.com/element-hq/synapse.git
synced 2024-12-18 00:43:30 +03:00
We can now upload avatar image somewhere
This commit is contained in:
parent
deae7f4f5d
commit
e6c62d5d7f
1 changed files with 13 additions and 4 deletions
|
@ -16,9 +16,9 @@ limitations under the License.
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('RoomsController', ['matrixService', 'mFileInput'])
|
angular.module('RoomsController', ['matrixService', 'mFileInput', 'mFileUpload'])
|
||||||
.controller('RoomsController', ['$scope', '$location', 'matrixService',
|
.controller('RoomsController', ['$scope', '$location', 'matrixService', 'mFileUpload',
|
||||||
function($scope, $location, matrixService) {
|
function($scope, $location, matrixService, mFileUpload) {
|
||||||
|
|
||||||
$scope.rooms = [];
|
$scope.rooms = [];
|
||||||
$scope.public_rooms = [];
|
$scope.public_rooms = [];
|
||||||
|
@ -167,7 +167,16 @@ angular.module('RoomsController', ['matrixService', 'mFileInput'])
|
||||||
|
|
||||||
$scope.$watch("newProfileInfo.avatarFile", function(newValue, oldValue) {
|
$scope.$watch("newProfileInfo.avatarFile", function(newValue, oldValue) {
|
||||||
if ($scope.newProfileInfo.avatarFile) {
|
if ($scope.newProfileInfo.avatarFile) {
|
||||||
//@TODO: Upload this HTML5 image file to somewhere
|
console.log("Uploading new avatar file...");
|
||||||
|
mFileUpload.uploadFile($scope.newProfileInfo.avatarFile).then(
|
||||||
|
function(url) {
|
||||||
|
$scope.newProfileInfo.avatar = url;
|
||||||
|
$scope.setAvatar($scope.newProfileInfo.avatar);
|
||||||
|
},
|
||||||
|
function(error) {
|
||||||
|
$scope.feedback = "Can't upload image";
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue