|
|
@ -3140,7 +3140,7 @@ angular.module('myApp.directives', ['myApp.filters']) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
.directive('myUserStatus', function ($filter, $rootScope, AppUsersManager) { |
|
|
|
.directive('myUserStatus', function (_, $filter, $rootScope, AppUsersManager) { |
|
|
|
var statusFilter = $filter('userStatus') |
|
|
|
var statusFilter = $filter('userStatus') |
|
|
|
var ind = 0 |
|
|
|
var ind = 0 |
|
|
|
var statuses = {} |
|
|
|
var statuses = {} |
|
|
@ -3166,12 +3166,18 @@ angular.module('myApp.directives', ['myApp.filters']) |
|
|
|
function link ($scope, element, attrs) { |
|
|
|
function link ($scope, element, attrs) { |
|
|
|
var userID |
|
|
|
var userID |
|
|
|
var curInd = ind++ |
|
|
|
var curInd = ind++ |
|
|
|
|
|
|
|
var forDialog = attrs.forDialog && $scope.$eval(attrs.forDialog) |
|
|
|
|
|
|
|
|
|
|
|
var update = function () { |
|
|
|
var update = function () { |
|
|
|
var user = AppUsersManager.getUser(userID) |
|
|
|
var user = AppUsersManager.getUser(userID) |
|
|
|
element |
|
|
|
if (forDialog && user.pFlags.self) { |
|
|
|
.html(statusFilter(user, attrs.botChatPrivacy)) |
|
|
|
element.html('') |
|
|
|
.toggleClass('status_online', (user.status && user.status._ == 'userStatusOnline') || false) |
|
|
|
} else { |
|
|
|
// console.log(dT(), 'update status', element[0], user.status && user.status, tsNow(true), element.html())
|
|
|
|
element |
|
|
|
|
|
|
|
.html(statusFilter(user, attrs.botChatPrivacy)) |
|
|
|
|
|
|
|
.toggleClass('status_online', (user.status && user.status._ == 'userStatusOnline') || false) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// console.log(dT(), 'update status', element[0], user.status && user.status, tsNow(true), element.html())
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$scope.$watch(attrs.myUserStatus, function (newUserID) { |
|
|
|
$scope.$watch(attrs.myUserStatus, function (newUserID) { |
|
|
@ -3331,7 +3337,7 @@ angular.module('myApp.directives', ['myApp.filters']) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
.directive('myPeerLink', function ($rootScope, AppChatsManager, AppUsersManager, AppMessagesIDsManager) { |
|
|
|
.directive('myPeerLink', function (_, $rootScope, AppPeersManager, AppChatsManager, AppUsersManager, AppMessagesIDsManager) { |
|
|
|
return { |
|
|
|
return { |
|
|
|
link: link |
|
|
|
link: link |
|
|
|
} |
|
|
|
} |
|
|
@ -3340,6 +3346,7 @@ angular.module('myApp.directives', ['myApp.filters']) |
|
|
|
var override = attrs.userOverride && $scope.$eval(attrs.userOverride) || {} |
|
|
|
var override = attrs.userOverride && $scope.$eval(attrs.userOverride) || {} |
|
|
|
var short = attrs.short && $scope.$eval(attrs.short) |
|
|
|
var short = attrs.short && $scope.$eval(attrs.short) |
|
|
|
var username = attrs.username && $scope.$eval(attrs.username) |
|
|
|
var username = attrs.username && $scope.$eval(attrs.username) |
|
|
|
|
|
|
|
var forDialog = attrs.forDialog && $scope.$eval(attrs.forDialog) |
|
|
|
|
|
|
|
|
|
|
|
var peerID |
|
|
|
var peerID |
|
|
|
var update = function () { |
|
|
|
var update = function () { |
|
|
@ -3348,16 +3355,21 @@ angular.module('myApp.directives', ['myApp.filters']) |
|
|
|
} |
|
|
|
} |
|
|
|
if (peerID > 0) { |
|
|
|
if (peerID > 0) { |
|
|
|
var user = AppUsersManager.getUser(peerID) |
|
|
|
var user = AppUsersManager.getUser(peerID) |
|
|
|
var prefix = username ? '@' : '' |
|
|
|
if (forDialog && user.pFlags.self) { |
|
|
|
var key = username ? 'username' : (short ? 'rFirstName' : 'rFullName') |
|
|
|
element.text(_('user_name_saved_msgs_raw')) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
var prefix = username ? '@' : '' |
|
|
|
|
|
|
|
var key = username ? 'username' : (short ? 'rFirstName' : 'rFullName') |
|
|
|
|
|
|
|
|
|
|
|
element.html( |
|
|
|
element.html( |
|
|
|
prefix + |
|
|
|
prefix + |
|
|
|
(override[key] || user[key] || '').valueOf() + |
|
|
|
(override[key] || user[key] || '').valueOf() + |
|
|
|
(attrs.verified && user.pFlags && user.pFlags.verified ? ' <i class="icon-verified"></i>' : '') |
|
|
|
(attrs.verified && user.pFlags && user.pFlags.verified ? ' <i class="icon-verified"></i>' : '') |
|
|
|
) |
|
|
|
) |
|
|
|
if (attrs.color && $scope.$eval(attrs.color)) { |
|
|
|
|
|
|
|
element.addClass('user_color_' + user.num) |
|
|
|
if (attrs.color && $scope.$eval(attrs.color)) { |
|
|
|
|
|
|
|
element.addClass('user_color_' + user.num) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
var chat = AppChatsManager.getChat(-peerID) |
|
|
|
var chat = AppChatsManager.getChat(-peerID) |
|
|
@ -3375,12 +3387,19 @@ angular.module('myApp.directives', ['myApp.filters']) |
|
|
|
AppUsersManager.openUser(peerID, override) |
|
|
|
AppUsersManager.openUser(peerID, override) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
var chatID = -peerID |
|
|
|
var chatID = -peerID |
|
|
|
var postID = $scope.$eval(attrs.postId) |
|
|
|
var postID = attrs.postId && $scope.$eval(attrs.postId) |
|
|
|
|
|
|
|
var savedFrom = attrs.savedFrom && $scope.$eval(attrs.savedFrom) |
|
|
|
if (postID) { |
|
|
|
if (postID) { |
|
|
|
$rootScope.$broadcast('history_focus', { |
|
|
|
$rootScope.$broadcast('history_focus', { |
|
|
|
peerString: AppChatsManager.getChatString(chatID), |
|
|
|
peerString: AppChatsManager.getChatString(chatID), |
|
|
|
messageID: AppMessagesIDsManager.getFullMessageID(parseInt(postID), chatID) |
|
|
|
messageID: AppMessagesIDsManager.getFullMessageID(parseInt(postID), chatID) |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
} else if (savedFrom) { |
|
|
|
|
|
|
|
var peerMid = savedFrom.split('_') |
|
|
|
|
|
|
|
$rootScope.$broadcast('history_focus', { |
|
|
|
|
|
|
|
peerString: AppPeersManager.getPeerString(peerMid[0]), |
|
|
|
|
|
|
|
messageID: peerMid[1] |
|
|
|
|
|
|
|
}) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
AppChatsManager.openChat(chatID) |
|
|
|
AppChatsManager.openChat(chatID) |
|
|
|
} |
|
|
|
} |
|
|
@ -3426,6 +3445,7 @@ angular.module('myApp.directives', ['myApp.filters']) |
|
|
|
var initEl = $('<span class="peer_initials nocopy ' + (attrs.imgClass || '') + '"></span>') |
|
|
|
var initEl = $('<span class="peer_initials nocopy ' + (attrs.imgClass || '') + '"></span>') |
|
|
|
var jump = 0 |
|
|
|
var jump = 0 |
|
|
|
var prevClass = false |
|
|
|
var prevClass = false |
|
|
|
|
|
|
|
var forDialog = attrs.forDialog && $scope.$eval(attrs.forDialog) |
|
|
|
|
|
|
|
|
|
|
|
var setPeerID = function (newPeerID) { |
|
|
|
var setPeerID = function (newPeerID) { |
|
|
|
if (peerID == newPeerID) { |
|
|
|
if (peerID == newPeerID) { |
|
|
@ -3453,6 +3473,12 @@ angular.module('myApp.directives', ['myApp.filters']) |
|
|
|
|
|
|
|
|
|
|
|
peerPhoto = peer.photo && angular.copy(peer.photo.photo_small) |
|
|
|
peerPhoto = peer.photo && angular.copy(peer.photo.photo_small) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (forDialog && peer.pFlags && peer.pFlags.self) { |
|
|
|
|
|
|
|
initEl.remove() |
|
|
|
|
|
|
|
imgEl.prependTo(element).attr('src', 'img/icons/icon120.png') |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var hasPhoto = peerPhoto !== undefined |
|
|
|
var hasPhoto = peerPhoto !== undefined |
|
|
|
|
|
|
|
|
|
|
|
if (hasPhoto) { |
|
|
|
if (hasPhoto) { |
|
|
|