Browse Source

Fixed add contact from attachment

Closes #492
master
Igor Zhukov 10 years ago
parent
commit
8f34169774
  1. 5
      app/js/controllers.js
  2. 4
      app/js/directives.js
  3. 3
      app/js/services.js
  4. 4
      app/partials/desktop/message_attach_contact.html
  5. 4
      app/partials/mobile/message_attach_contact.html

5
app/js/controllers.js

@ -1811,6 +1811,11 @@ angular.module('myApp.controllers', ['myApp.i18n']) @@ -1811,6 +1811,11 @@ angular.module('myApp.controllers', ['myApp.i18n'])
MtpApiManager.invokeApi('users.getFullUser', {
id: AppUsersManager.getUserInput($scope.userID)
}).then(function (userFullResult) {
if ($scope.override && !userFullResult.user.phone) {
userFullResult.user.phone = $scope.override.phone_number;
userFullResult.user.first_name = $scope.override.first_name;
userFullResult.user.last_name = $scope.override.last_name;
}
AppUsersManager.saveApiUser(userFullResult.user);
AppPhotosManager.savePhoto(userFullResult.profile_photo);
if (userFullResult.profile_photo._ != 'photoEmpty') {

4
app/js/directives.js

@ -1767,7 +1767,7 @@ angular.module('myApp.directives', ['myApp.filters']) @@ -1767,7 +1767,7 @@ angular.module('myApp.directives', ['myApp.filters'])
if (element[0].tagName == 'A') {
element.on('click', function () {
$rootScope.openUser(userID);
$rootScope.openUser(userID, attrs.userOverride && $scope.$eval(attrs.userOverride));
});
}
if (attrs.color && $scope.$eval(attrs.color)) {
@ -1840,7 +1840,7 @@ angular.module('myApp.directives', ['myApp.filters']) @@ -1840,7 +1840,7 @@ angular.module('myApp.directives', ['myApp.filters'])
if (element[0].tagName == 'A') {
element.on('click', function (e) {
$rootScope.openUser($scope.userID);
$rootScope.openUser($scope.userID, attrs.userOverride && $scope.$eval(attrs.userOverride));
});
}

3
app/js/services.js

@ -184,9 +184,10 @@ angular.module('myApp.services', ['myApp.i18n']) @@ -184,9 +184,10 @@ angular.module('myApp.services', ['myApp.i18n'])
return user;
}
function openUser (userID, accessHash) {
function openUser (userID, override) {
var scope = $rootScope.$new();
scope.userID = userID;
scope.override = override || {};
var modalInstance = $modal.open({
templateUrl: templateUrl('user_modal'),

4
app/partials/desktop/message_attach_contact.html

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
<div>
<a class="im_message_contact_photo pull-left" my-user-photolink="historyMessage.media.user_id" img-class="im_message_contact_photo"></a>
<a class="im_message_contact_photo pull-left" my-user-photolink="historyMessage.media.user_id" img-class="im_message_contact_photo" user-override="historyMessage.media"></a>
<div class="im_message_contact_name" ng-switch="historyMessage.media.user_id > 0">
<a ng-switch-when="true" my-user-link="historyMessage.media.user_id"></a>
<a ng-switch-when="true" my-user-link="historyMessage.media.user_id" user-override="historyMessage.media"></a>
<span ng-switch-default ng-bind-html="::historyMessage.media.rFullName"></span>
</div>
<div class="im_message_contact_phone" ng-bind="::historyMessage.media.phone_number | phoneNumber"></div>

4
app/partials/mobile/message_attach_contact.html

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
<div>
<a class="im_message_contact_photo pull-left" my-user-photolink="historyMessage.media.user_id" img-class="im_message_contact_photo"></a>
<a class="im_message_contact_photo pull-left" my-user-photolink="historyMessage.media.user_id" img-class="im_message_contact_photo" user-override="historyMessage.media"></a>
<div class="im_message_contact_name" ng-switch="historyMessage.media.user_id > 0">
<a ng-switch-when="true" my-user-link="historyMessage.media.user_id"></a>
<a ng-switch-when="true" my-user-link="historyMessage.media.user_id" user-override="historyMessage.media"></a>
<span ng-switch-default ng-bind-html="::historyMessage.media.rFullName"></span>
</div>
<div class="im_message_contact_phone" ng-bind="::historyMessage.media.phone_number | phoneNumber"></div>

Loading…
Cancel
Save