Browse Source

Multi-forward functionality #1492 (#1588)

* Multi forward functionality #1492

* Remove unused variable

* Changes according to pull request review 88460714
master
Aziz Khakulov 7 years ago committed by Igor Zhukov
parent
commit
81448595bb
  1. 47
      app/js/controllers.js
  2. 20
      app/less/desktop.less
  3. 2
      app/partials/desktop/dialog.html

47
app/js/controllers.js

@ -1941,15 +1941,34 @@ angular.module('myApp.controllers', ['myApp.i18n']) @@ -1941,15 +1941,34 @@ angular.module('myApp.controllers', ['myApp.i18n'])
})
}
if (selectedMessageIDs.length) {
PeersSelectService.selectPeer({canSend: true}).then(function (peerString) {
PeersSelectService.selectPeer({canSend: true}).then(function (peerStrings) {
selectedCancel()
if (Array.isArray(peerStrings) && peerStrings.length > 1) {
angular.forEach(peerStrings, function (peerString) {
var peerID = AppPeersManager.getPeerID(peerString)
AppMessagesManager.forwardMessages(peerID, selectedMessageIDs)
})
var toastData = toaster.pop({
type: 'info',
body: _('confirm_modal_forward_to_peer_success'),
bodyOutputType: 'trustedHtml',
clickHandler: function () {
$rootScope.$broadcast('history_focus', {
peerString: peerString,
peerString: peerStrings[0]
})
toaster.clear(toastData)
},
showCloseButton: false
})
} else {
$rootScope.$broadcast('history_focus', {
peerString: peerStrings,
attachment: {
_: 'fwd_messages',
id: selectedMessageIDs
}
})
}
})
}
}
@ -4926,6 +4945,30 @@ angular.module('myApp.controllers', ['myApp.i18n']) @@ -4926,6 +4945,30 @@ angular.module('myApp.controllers', ['myApp.i18n'])
})
}
$scope.dialogMultiSelect = function(peerString, event) {
var peerID = AppPeersManager.getPeerID(peerString)
$scope.multiSelect = $scope.selectedPeers[peerID] == undefined ||
$scope.selectedPeers[peerID] != undefined && Object.keys($scope.selectedPeers).length > 1
if ($scope.selectedPeers[peerID]) {
delete $scope.selectedPeers[peerID]
$scope.selectedCount--
var pos = $scope.selectedPeerIDs.indexOf(peerID)
if (pos >= 0) {
$scope.selectedPeerIDs.splice(pos, 1)
}
} else {
$scope.selectedPeers[peerID] = AppPeersManager.getPeer(peerID)
$scope.selectedCount++
$scope.selectedPeerIDs.unshift(peerID)
}
cancelEvent(event)
}
$scope.isSelected = function(peerString){
var peerID = AppPeersManager.getPeerID(peerString)
return $scope.selectedPeers[peerID] != undefined
}
$scope.dialogSelect = function (peerString) {
var peerID
if (!$scope.multiSelect) {

20
app/less/desktop.less

@ -964,6 +964,26 @@ a.footer_link.active:active { @@ -964,6 +964,26 @@ a.footer_link.active:active {
.icon-select-tick {
display: none;
.im_dialogs_modal_list .im_dialog_wrap .im_dialog &{
display: block;
margin: 10px 5px 0 -5px;
position: relative;
float: left;
width: 26px;
height: 26px;
.image-2x('../img/icons/IconsetW.png', 42px, 1171px);
background-position: -9px -481px;
opacity: 0.5;
}
.im_dialogs_modal_list .im_dialog_wrap:hover .im_dialog &{
opacity: 0.75;
}
&.dialog_selected{
opacity: 1 !important;
}
}
@media (min-width: 900px) {

2
app/partials/desktop/dialog.html

@ -18,6 +18,8 @@ @@ -18,6 +18,8 @@
></i>
</div>
<i class="icon icon-select-tick" ng-class="{dialog_selected: isSelected(dialogMessage.peerString)}" ng-mousedown="dialogMultiSelect(dialogMessage.peerString, $event)"></i>
<div class="im_dialog_photo pull-left" my-peer-photolink="::dialogMessage.peerID" img-class="im_dialog_photo" watch="true" for-dialog="!dialogMessage.foundInHistory"></div>
<div class="im_dialog_message_wrap">

Loading…
Cancel
Save