Fixed drafts position in conversations
This commit is contained in:
parent
2d202443e1
commit
0e531b27a9
@ -782,12 +782,15 @@ angular.module('myApp.controllers', ['myApp.i18n'])
|
||||
deleteDialog(dialog.peerID)
|
||||
})
|
||||
|
||||
$scope.$on('draft_updated', function (e, draftUpdate) {
|
||||
$scope.$on('dialog_draft', function (e, draftUpdate) {
|
||||
var curDialog, i
|
||||
for (i = 0; i < $scope.dialogs.length; i++) {
|
||||
curDialog = $scope.dialogs[i]
|
||||
if (curDialog.peerID == draftUpdate.peerID) {
|
||||
curDialog.draft = draftUpdate.draft
|
||||
if (draftUpdate.index) {
|
||||
curDialog.index = draftUpdate.index
|
||||
}
|
||||
if (i > 0 && draftUpdate.draft) {
|
||||
$scope.dialogs.splice(i, 1)
|
||||
$scope.dialogs.unshift(curDialog)
|
||||
|
@ -3156,23 +3156,6 @@ angular.module('myApp.services')
|
||||
})
|
||||
}
|
||||
break
|
||||
|
||||
case 'updateDraftMessage':
|
||||
var peerID = AppPeersManager.getPeerID(update.peer)
|
||||
var draft = DraftsManager.saveDraft(peerID, update.draft)
|
||||
|
||||
var dialog = getDialogByPeerID(peerID)[0]
|
||||
if (dialog) {
|
||||
if (dialog && draft && draft.date) {
|
||||
dialog.index = generateDialogIndex(draft.date)
|
||||
pushDialogToStorage(dialog)
|
||||
}
|
||||
$rootScope.$broadcast('dialog_draft', {
|
||||
peerID: peerID,
|
||||
draft: draft
|
||||
})
|
||||
}
|
||||
break
|
||||
}
|
||||
})
|
||||
|
||||
@ -3236,10 +3219,16 @@ angular.module('myApp.services')
|
||||
|
||||
var dialog = getDialogByPeerID(peerID)[0]
|
||||
if (dialog) {
|
||||
var newIndex
|
||||
if (dialog && draft && draft.date) {
|
||||
dialog.index = generateDialogIndex(draft.date)
|
||||
newIndex = dialog.index = generateDialogIndex(draft.date)
|
||||
pushDialogToStorage(dialog)
|
||||
}
|
||||
$rootScope.$broadcast('dialog_draft', {
|
||||
peerID: peerID,
|
||||
draft: draft,
|
||||
index: dialog && dialog.index
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user