2017-07-17 20:10:21 +08:00
|
|
|
(function () {
|
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
|
|
angular
|
|
|
|
|
.module('users')
|
|
|
|
|
.controller('UserInfoController', UserInfoController);
|
|
|
|
|
|
2017-09-13 14:54:58 +08:00
|
|
|
UserInfoController.$inject = ['$scope', '$state', 'Authentication', 'userResolve', 'ScoreLevelService', '$timeout', 'MeanTorrentConfig',
|
2017-09-13 15:05:28 +08:00
|
|
|
'DebugConsoleService'];
|
2017-07-17 20:10:21 +08:00
|
|
|
|
2017-09-13 14:54:58 +08:00
|
|
|
function UserInfoController($scope, $state, Authentication, user, ScoreLevelService, $timeout, MeanTorrentConfig, mtDebug) {
|
2017-07-17 20:10:21 +08:00
|
|
|
var vm = this;
|
|
|
|
|
|
|
|
|
|
vm.authentication = Authentication;
|
2017-08-14 12:46:55 +08:00
|
|
|
vm.announce = MeanTorrentConfig.meanTorrentConfig.announce;
|
2017-07-17 20:10:21 +08:00
|
|
|
vm.user = user;
|
|
|
|
|
vm.messageTo = messageTo;
|
|
|
|
|
vm.isContextUserSelf = isContextUserSelf;
|
|
|
|
|
vm.scoreLevelData = ScoreLevelService.getScoreLevelJson(vm.user.score);
|
|
|
|
|
|
2017-09-13 14:54:58 +08:00
|
|
|
mtDebug.info(user);
|
|
|
|
|
|
2017-07-17 20:10:21 +08:00
|
|
|
/**
|
|
|
|
|
* messageTo
|
|
|
|
|
*/
|
|
|
|
|
function messageTo() {
|
|
|
|
|
var to = vm.user._id + '|' + vm.user.username;
|
|
|
|
|
$state.go('messages.send', {to: to});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* isContextUserSelf
|
|
|
|
|
* @returns {boolean}
|
|
|
|
|
*/
|
|
|
|
|
function isContextUserSelf() {
|
|
|
|
|
return vm.user.username === vm.authentication.user.username;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}());
|