Fixed invalid dimensions problem

Now sending as document if fails as photo

Closes #726
This commit is contained in:
Igor Zhukov 2015-03-19 16:17:34 +03:00
parent a12bcaa4b9
commit 40c8fd11a7

View File

@ -1569,12 +1569,17 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
$rootScope.$broadcast('messages_pending');
}
var uploaded = false,
uploadPromise;
message.send = function () {
var sendFileDeferred = $q.defer();
sendFilePromise.then(function () {
var uploaded = false,
uploadPromise = MtpApiFileManager.uploadFile(file);
if (!uploaded || message.error) {
uploaded = false;
uploadPromise = MtpApiFileManager.uploadFile(file);
}
uploadPromise.then(function (inputFile) {
inputFile.name = apiFileName;
@ -1626,6 +1631,14 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
}]
});
}, function (error) {
if (attachType == 'photo' &&
error.code == 400 &&
error.type == 'PHOTO_INVALID_DIMENSIONS') {
error.handled = true;
attachType = 'document';
message.send();
return;
}
toggleError(true);
});
}, function (error) {