|
|
@ -4480,7 +4480,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
var peerID = AppPeersManager.getPeerID(update.peer) |
|
|
|
var peerID = AppPeersManager.getPeerID(update.peer) |
|
|
|
saveDraft(peerID, update.draft, true) |
|
|
|
saveDraft(peerID, update.draft, {notify: true}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
return { |
|
|
|
return { |
|
|
@ -4526,18 +4526,18 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) |
|
|
|
return false |
|
|
|
return false |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function saveDraft (peerID, apiDraft, notify) { |
|
|
|
function saveDraft (peerID, apiDraft, options) { |
|
|
|
if (notify) { |
|
|
|
options = options || {} |
|
|
|
console.warn(dT(), 'save draft', peerID, apiDraft, notify) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
var draft = processApiDraft(apiDraft) |
|
|
|
var draft = processApiDraft(apiDraft) |
|
|
|
cachedServerDrafts[peerID] = draft |
|
|
|
cachedServerDrafts[peerID] = draft |
|
|
|
|
|
|
|
|
|
|
|
if (notify) { |
|
|
|
if (options.notify) { |
|
|
|
|
|
|
|
console.warn(dT(), 'save draft', peerID, apiDraft, options) |
|
|
|
changeDraft(peerID, draft) |
|
|
|
changeDraft(peerID, draft) |
|
|
|
$rootScope.$broadcast('draft_updated', { |
|
|
|
$rootScope.$broadcast('draft_updated', { |
|
|
|
peerID: peerID, |
|
|
|
peerID: peerID, |
|
|
|
draft: draft |
|
|
|
draft: draft, |
|
|
|
|
|
|
|
local: options.sync |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -4659,7 +4659,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) |
|
|
|
} |
|
|
|
} |
|
|
|
MtpApiManager.invokeApi('messages.saveDraft', params).then(function () { |
|
|
|
MtpApiManager.invokeApi('messages.saveDraft', params).then(function () { |
|
|
|
draftObj.date = tsNow(true) + ServerTimeManager.serverTimeOffset |
|
|
|
draftObj.date = tsNow(true) + ServerTimeManager.serverTimeOffset |
|
|
|
saveDraft(peerID, draftObj, true) |
|
|
|
saveDraft(peerID, draftObj, {notify: true, sync: true}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|