Merge pull request #442 from gabrielbazan7/feat/pushNotifications
fix user field ( push notifications )
This commit is contained in:
commit
73e60d5d0f
|
@ -523,9 +523,9 @@ ExpressApp.prototype.start = function(opts, cb) {
|
|||
});
|
||||
});
|
||||
|
||||
router.delete('/v1/pushnotifications/subscriptions/:token/', function(req, res) {
|
||||
router.delete('/v1/pushnotifications/subscriptions/', function(req, res) {
|
||||
getServerWithAuth(req, res, function(server) {
|
||||
server.pushNotificationsUnsubscribe(req.params['token'], function(err, response) {
|
||||
server.pushNotificationsUnsubscribe(function(err, response) {
|
||||
if (err) return returnError(err, res, req);
|
||||
res.json(response);
|
||||
});
|
||||
|
|
|
@ -2433,7 +2433,7 @@ WalletService.prototype.pushNotificationsSubscribe = function(opts, cb) {
|
|||
|
||||
var self = this;
|
||||
|
||||
opts.user = self.walletId + '$' + self.copayerId + '$' + opts.token;
|
||||
opts.user = self.walletId + '$' + self.copayerId;
|
||||
|
||||
request({
|
||||
url: config.pushNotificationsOpts.pushServerUrl + '/subscribe',
|
||||
|
@ -2445,7 +2445,7 @@ WalletService.prototype.pushNotificationsSubscribe = function(opts, cb) {
|
|||
});
|
||||
};
|
||||
|
||||
WalletService.prototype.pushNotificationsUnsubscribe = function(token, cb) {
|
||||
WalletService.prototype.pushNotificationsUnsubscribe = function(cb) {
|
||||
var self = this;
|
||||
|
||||
request({
|
||||
|
@ -2453,7 +2453,7 @@ WalletService.prototype.pushNotificationsUnsubscribe = function(token, cb) {
|
|||
method: 'POST',
|
||||
json: true,
|
||||
body: {
|
||||
user: self.walletId + '$' + self.copayerId + '$' + token
|
||||
user: self.walletId + '$' + self.copayerId
|
||||
}
|
||||
}, function(err, response) {
|
||||
return cb(err, response);
|
||||
|
|
|
@ -5478,7 +5478,7 @@ describe('Wallet service', function() {
|
|||
});
|
||||
args[0].body.user.should.contain(wallet.copayers[0].id);
|
||||
args[0].body.user.should.contain(wallet.id);
|
||||
args[0].body.user.should.contain('DEVICE_TOKEN');
|
||||
args[0].body.token.should.contain('DEVICE_TOKEN');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
@ -5488,7 +5488,7 @@ describe('Wallet service', function() {
|
|||
request.yields();
|
||||
helpers.getAuthServer(wallet.copayers[0].id, function(server) {
|
||||
should.exist(server);
|
||||
server.pushNotificationsUnsubscribe('DEVICE_TOKEN', function(err, response) {
|
||||
server.pushNotificationsUnsubscribe(function(err, response) {
|
||||
should.not.exist(err);
|
||||
var calls = request.getCalls();
|
||||
calls.length.should.equal(1);
|
||||
|
@ -5498,7 +5498,6 @@ describe('Wallet service', function() {
|
|||
|
||||
args[0].body.user.should.contain(wallet.copayers[0].id);
|
||||
args[0].body.user.should.contain(wallet.id);
|
||||
args[0].body.user.should.contain('DEVICE_TOKEN');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue