Bug 1093475 When a Loop call URL is deleted/blocked, use the proper session. r=mikedeboer

This commit is contained in:
Mark Banner
2014-11-05 13:59:46 +00:00
parent 63437503f0
commit 660b361df5
5 changed files with 44 additions and 27 deletions

View File

@@ -151,23 +151,25 @@ loop.Client = (function($) {
* Block call URL based on the token identifier
*
* @param {string} token Conversation identifier used to block the URL
* @param {mozLoop.LOOP_SESSION_TYPE} sessionType The type of session which
* the url belongs to.
* @param {function} cb Callback function used for handling an error
* response. XXX The incoming call panel does not
* exist after the block button is clicked therefore
* it does not make sense to display an error.
**/
deleteCallUrl: function(token, cb) {
deleteCallUrl: function(token, sessionType, cb) {
this._ensureRegistered(function(err) {
if (err) {
cb(err);
return;
}
this._deleteCallUrlInternal(token, cb);
this._deleteCallUrlInternal(token, sessionType, cb);
}.bind(this));
},
_deleteCallUrlInternal: function(token, cb) {
_deleteCallUrlInternal: function(token, sessionType, cb) {
function deleteRequestCallback(error, responseText) {
if (error) {
this._failureHandler(cb, error);
@@ -182,8 +184,7 @@ loop.Client = (function($) {
}
}
// XXX hard-coding of GUEST to be removed by 1065155
this.mozLoop.hawkRequest(this.mozLoop.LOOP_SESSION_TYPE.GUEST,
this.mozLoop.hawkRequest(sessionType,
"/call-url/" + token, "DELETE", null,
deleteRequestCallback.bind(this));
},