Skip to content

Commit ef25918

Browse files
committed
When exporting contacts from a group, the file name must be the same as the group name.
1 parent 771c67c commit ef25918

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

js/views/CContactsView.js

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -816,7 +816,9 @@ CContactsView.prototype.executeExport = function (sFormat)
816816
aContactUUIDs = _.map(this.selector.listChecked(), function (oContact) {
817817
return oContact.sUUID;
818818
}),
819-
sStorage = this.selectedStorage()
819+
sStorage = this.selectedStorage(),
820+
sGroupUUID = this.currentGroupUUID(),
821+
filename = 'export'
820822
;
821823
if (sStorage === 'group')
822824
{
@@ -828,8 +830,20 @@ CContactsView.prototype.executeExport = function (sFormat)
828830
'GroupUUID': this.currentGroupUUID(),
829831
'ContactUUIDs': aContactUUIDs
830832
}, function (oResponse) {
833+
834+
filename = this.getStorageDisplayName(sStorage);
835+
836+
if (sGroupUUID) {
837+
var oGroup = _.find(this.groupFullCollection(), function (oItem) {
838+
return oItem && oItem.UUID() === sGroupUUID;
839+
});
840+
if (oGroup) {
841+
filename = oGroup.Name();
842+
}
843+
}
844+
831845
var oBlob = new Blob([oResponse.ResponseText], {'type': 'text/plain;charset=utf-8'});
832-
FileSaver.saveAs(oBlob, this.getStorageDisplayName(sStorage) + '.' + sFormat, true);
846+
FileSaver.saveAs(oBlob, filename + '.' + sFormat, true);
833847
}, this, { Format: 'Raw' });
834848
};
835849

0 commit comments

Comments
 (0)