Browse Source

Fixed commands in channel

Closes #965
master
Igor Zhukov 9 years ago
parent
commit
ddc4c87b50
  1. 4
      app/js/directives.js
  2. 7
      app/js/lib/mtproto_wrapper.js

4
app/js/directives.js

@ -451,7 +451,7 @@ angular.module('myApp.directives', ['myApp.filters'])
}) })
.directive('myMessageText', function(AppPeersManager, AppMessagesManager, AppUsersManager, RichTextProcessor) { .directive('myMessageText', function(AppPeersManager, AppMessagesManager, AppChatsManager, AppUsersManager, RichTextProcessor) {
return { return {
link: link, link: link,
scope: { scope: {
@ -465,7 +465,7 @@ angular.module('myApp.directives', ['myApp.filters'])
var fromBot = fromUser && fromUser.pFlags.bot && fromUser.username || false; var fromBot = fromUser && fromUser.pFlags.bot && fromUser.username || false;
var toPeerID = AppPeersManager.getPeerID(message.to_id); var toPeerID = AppPeersManager.getPeerID(message.to_id);
var withBot = (fromBot || var withBot = (fromBot ||
toPeerID < 0 || toPeerID < 0 && !(AppChatsManager.isChannel(-toPeerID) && !AppChatsManager.isMegagroup(-toPeerID)) ||
toPeerID > 0 && AppUsersManager.isBot(toPeerID)); toPeerID > 0 && AppUsersManager.isBot(toPeerID));
var options = { var options = {

7
app/js/lib/mtproto_wrapper.js

@ -487,14 +487,14 @@ angular.module('izhukov.mtproto.wrapper', ['izhukov.utils', 'izhukov.mtproto'])
} }
} }
console.log(dT(), 'Dload file', dcID, location, size); // console.log(dT(), 'Dload file', dcID, location, size);
var fileName = getFileName(location), var fileName = getFileName(location),
toFileEntry = options.toFileEntry || null, toFileEntry = options.toFileEntry || null,
cachedPromise = cachedSavePromises[fileName] || cachedDownloadPromises[fileName]; cachedPromise = cachedSavePromises[fileName] || cachedDownloadPromises[fileName];
var fileStorage = getFileStorage(); var fileStorage = getFileStorage();
console.log(dT(), 'fs', fileStorage.name, fileName, cachedPromise); // console.log(dT(), 'fs', fileStorage.name, fileName, cachedPromise);
if (cachedPromise) { if (cachedPromise) {
if (toFileEntry) { if (toFileEntry) {
@ -520,9 +520,7 @@ angular.module('izhukov.mtproto.wrapper', ['izhukov.utils', 'izhukov.mtproto'])
}; };
console.log(dT(), 'fs get file', fileName, size);
fileStorage.getFile(fileName, size).then(function (blob) { fileStorage.getFile(fileName, size).then(function (blob) {
console.log(dT(), 'fs got file', fileName, size);
if (toFileEntry) { if (toFileEntry) {
FileManager.copy(blob, toFileEntry).then(function () { FileManager.copy(blob, toFileEntry).then(function () {
deferred.resolve(); deferred.resolve();
@ -531,7 +529,6 @@ angular.module('izhukov.mtproto.wrapper', ['izhukov.utils', 'izhukov.mtproto'])
deferred.resolve(cachedDownloads[fileName] = blob); deferred.resolve(cachedDownloads[fileName] = blob);
} }
}, function () { }, function () {
console.log(dT(), 'fs fail file', fileName, size);
var fileWriterPromise = toFileEntry ? FileManager.getFileWriter(toFileEntry) : fileStorage.getFileWriter(fileName, mimeType); var fileWriterPromise = toFileEntry ? FileManager.getFileWriter(toFileEntry) : fileStorage.getFileWriter(fileName, mimeType);
var processDownloaded = function (bytes) { var processDownloaded = function (bytes) {

Loading…
Cancel
Save