Browse Source

Fixed shared contact attachment

master
Igor Zhukov 10 years ago
parent
commit
0b79453405
  1. 4
      app/css/app.css
  2. 10
      app/css/mobile.css
  3. 8
      app/js/controllers.js
  4. 20
      app/js/directives.js
  5. 2
      app/partials/desktop/message.html
  6. 2
      app/partials/mobile/message.html

4
app/css/app.css

@ -1144,6 +1144,10 @@ a.im_message_contact_photo { @@ -1144,6 +1144,10 @@ a.im_message_contact_photo {
.im_message_contact_name {
font-weight: bold;
}
.im_message_contact_name,
.im_message_contact_phone {
white-space: nowrap;
}
a.im_message_photo_thumb,
a.im_message_video_thumb {
display: block;

10
app/css/mobile.css

@ -387,6 +387,16 @@ html { @@ -387,6 +387,16 @@ html {
width: auto;
max-width: 250px;
}
.im_message_contact {
width: 200px;
}
.im_message_contact_name,
.im_message_contact_phone {
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
max-width: 150px;
}
.im_message_document {
position: relative;
}

8
app/js/controllers.js

@ -1886,10 +1886,12 @@ angular.module('myApp.controllers', ['myApp.i18n']) @@ -1886,10 +1886,12 @@ angular.module('myApp.controllers', ['myApp.i18n'])
MtpApiManager.invokeApi('users.getFullUser', {
id: AppUsersManager.getUserInput($scope.userID)
}).then(function (userFullResult) {
if ($scope.override && $scope.override.phone_number && !userFullResult.user.phone) {
if ($scope.override && $scope.override.phone_number) {
userFullResult.user.phone = $scope.override.phone_number;
userFullResult.user.first_name = $scope.override.first_name;
userFullResult.user.last_name = $scope.override.last_name;
if ($scope.override.first_name || $scope.override.last_name) {
userFullResult.user.first_name = $scope.override.first_name;
userFullResult.user.last_name = $scope.override.last_name;
}
AppUsersManager.saveApiUser(userFullResult.user);
} else {
AppUsersManager.saveApiUser(userFullResult.user, true);

20
app/js/directives.js

@ -2023,12 +2023,16 @@ angular.module('myApp.directives', ['myApp.filters']) @@ -2023,12 +2023,16 @@ angular.module('myApp.directives', ['myApp.filters'])
function link($scope, element, attrs) {
var override = attrs.userOverride && $scope.$eval(attrs.userOverride) || {};
var short = attrs.short && $scope.$eval(attrs.short);
var userID;
var update = function () {
var user = AppUsersManager.getUser(userID);
var key = short ? 'rFirstName' : 'rFullName';
element.html(
(user[attrs.short && $scope.$eval(attrs.short) ? 'rFirstName' : 'rFullName'] || '').valueOf()
(override[key] || user[key] || '').valueOf()
);
if (attrs.color && $scope.$eval(attrs.color)) {
element.addClass('user_color_' + user.num);
@ -2037,7 +2041,7 @@ angular.module('myApp.directives', ['myApp.filters']) @@ -2037,7 +2041,7 @@ angular.module('myApp.directives', ['myApp.filters'])
if (element[0].tagName == 'A') {
element.on('click', function () {
AppUsersManager.openUser(userID, attrs.userOverride && $scope.$eval(attrs.userOverride));
AppUsersManager.openUser(userID, override);
});
}
@ -2102,22 +2106,22 @@ angular.module('myApp.directives', ['myApp.filters']) @@ -2102,22 +2106,22 @@ angular.module('myApp.directives', ['myApp.filters'])
return {
link: link,
scope: {
userID: '=myUserPhotolink'
},
template: '<img my-load-thumb thumb="photo" /><i class="icon icon-online" ng-if="::showStatus || false" ng-show="user.status._ == \'userStatusOnline\'"></i>'
};
function link($scope, element, attrs) {
$scope.photo = AppUsersManager.getUserPhoto($scope.userID, 'User');
var userID = $scope.$eval(attrs.myUserPhotolink);
$scope.photo = AppUsersManager.getUserPhoto(userID, 'User');
if ($scope.showStatus = attrs.status && $scope.$eval(attrs.status)) {
$scope.user = AppUsersManager.getUser($scope.userID);
$scope.user = AppUsersManager.getUser(userID);
}
if (element[0].tagName == 'A') {
element.on('click', function (e) {
AppUsersManager.openUser($scope.userID, attrs.userOverride && $scope.$eval(attrs.userOverride));
AppUsersManager.openUser(userID, attrs.userOverride && $scope.$eval(attrs.userOverride));
});
}

2
app/partials/desktop/message.html

@ -55,7 +55,7 @@ @@ -55,7 +55,7 @@
<div ng-switch-when="messageMediaDocument" my-message-document="historyMessage.media.document" message-id="historyMessage.id"></div>
<div ng-switch-when="messageMediaAudio" class="im_message_audio" my-audio-player audio="historyMessage.media.audio"></div>
<div ng-switch-when="messageMediaGeo" my-message-map></div>
<div ng-switch-when="messageMediaContact" my-message-contact></div>
<div ng-switch-when="messageMediaContact" class="im_message_contact" my-message-contact></div>
<div ng-switch-when="messageMediaPending" my-message-pending></div>
</div>

2
app/partials/mobile/message.html

@ -45,7 +45,7 @@ @@ -45,7 +45,7 @@
<div ng-switch-when="messageMediaDocument" my-message-document="historyMessage.media.document" message-id="historyMessage.id"></div>
<div ng-switch-when="messageMediaAudio" class="im_message_audio" my-audio-player audio="historyMessage.media.audio"></div>
<div ng-switch-when="messageMediaGeo" my-message-map></div>
<div ng-switch-when="messageMediaContact" my-message-contact></div>
<div ng-switch-when="messageMediaContact" class="im_message_contact" my-message-contact></div>
<div ng-switch-when="messageMediaPending" my-message-pending></div>
</div>

Loading…
Cancel
Save