Browse Source

UI-643: Added a type to the main user callflow to distinguish it from the faxbox callflow

4.3
Maxime Roux 11 years ago
parent
commit
596c83b9f1
2 changed files with 19 additions and 64 deletions
  1. +6
    -3
      submodules/strategy/strategy.js
  2. +13
    -61
      submodules/users/users.js

+ 6
- 3
submodules/strategy/strategy.js View File

@ -10,7 +10,7 @@ define(function(require){
requests: {
'strategy.callflows.listHasType': {
url: 'accounts/{accountId}/callflows?has_value=type',
url: 'accounts/{accountId}/callflows?has_value=type&key_missing=owner_id',
verb: 'GET'
},
'strategy.callflows.list': {
@ -30,7 +30,7 @@ define(function(require){
verb: 'POST'
},
'strategy.callflows.listUserCallflows': {
url: 'accounts/{accountId}/callflows?has_key=owner_id&key_missing=type',
url: 'accounts/{accountId}/callflows?has_key=owner_id',
verb: 'GET'
},
'strategy.callflows.listRingGroups': {
@ -2171,7 +2171,10 @@ define(function(require){
accountId: self.accountId
},
success: function(data, status) {
_callback(null, data.data);
var userCallflows = _.filter(data.data, function(callflow) {
return (callflow.type === 'mainUserCallflow' || !('type' in callflow));
});
_callback(null, userCallflows);
}
});
},


+ 13
- 61
submodules/users/users.js View File

@ -483,21 +483,8 @@ define(function(require){
});
},
userCallflow: function(callback) {
self.usersListCallflowsUser(currentUser.id, function(data) {
if(data.length > 0) {
monster.request({
resource: 'voip.users.getCallflow',
data: {
accountId: self.accountId,
callflowId: data[0].id
},
success: function(callflow) {
callback(null, callflow.data)
}
});
} else {
callback(null, null);
}
self.usersGetMainCallflow(currentUser.id, function(callflow) {
callback(null, callflow);
});
}
},
@ -1176,20 +1163,11 @@ define(function(require){
});
template.on('click', '.feature[data-feature="call_recording"]', function() {
self.usersListCallflowsUser(currentUser.id, function(data) {
if(data.length > 0) {
monster.request({
resource: 'voip.users.getCallflow',
data: {
accountId: self.accountId,
callflowId: data[0].id
},
success: function(callflow) {
self.usersRenderCallRecording({
userCallflow: callflow.data,
currentUser: currentUser
});
}
self.usersGetMainCallflow(currentUser.id, function(callflow) {
if(callflow) {
self.usersRenderCallRecording({
userCallflow: callflow,
currentUser: currentUser
});
} else {
monster.ui.alert('error', self.i18n.active().users.call_recording.noNumber);
@ -2978,6 +2956,7 @@ define(function(require){
self.usersCreateVMBox(data.vmbox, function(_dataVM) {
data.callflow.owner_id = userId;
data.callflow.type = 'mainUserCallflow';
data.callflow.flow.data.id = userId;
data.callflow.flow.children['_'].data.id = _dataVM.id;
@ -3030,7 +3009,8 @@ define(function(require){
},
name: fullName + ' SmartPBX\'s Callflow',
numbers: listExtensions,
owner_id: user.id
owner_id: user.id,
type: 'mainUserCallflow'
};
self.usersSmartUpdateVMBox(user, false, function(_dataVM) {
@ -3063,7 +3043,7 @@ define(function(require){
var indexMain = -1;
_.each(listCallflows, function(callflow, index) {
if(callflow.owner_id === userId) {
if(callflow.owner_id === userId && callflow.type === 'mainUserCallflow' || !('type' in callflow)) {
indexMain = index;
return false;
}
@ -3256,21 +3236,6 @@ define(function(require){
});
},
usersCreateCallflow: function(callflowData, callback) {
var self = this;
monster.request({
resource: 'voip.users.createCallflow',
data: {
accountId: self.accountId,
data: callflowData
},
success: function(data) {
callback(data.data);
}
});
},
usersGetUser: function(userId, callback) {
var self = this;
@ -3587,21 +3552,8 @@ define(function(require){
});
};
self.usersListCallflowsUser(userId, function(data) {
if(data.length > 0) {
monster.request({
resource: 'voip.users.getCallflow',
data: {
accountId: self.accountId,
callflowId: data[0].id
},
success: function(callflow) {
updateDevices(callflow.data);
}
});
} else {
updateDevices(null);
}
self.usersGetMainCallflow(userId, function(callflow) {
updateDevices(callflow)
});
},


Loading…
Cancel
Save