Skip to content

Commit ee361d8

Browse files
committed
fix(status): do not ignore the owner param of countUnreadStatuses/resetUnreadCount
1 parent 012b522 commit ee361d8

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/status.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const _ = require('underscore');
2+
const Promise = require('./promise');
23
const AVRequest = require('./request')._request;
34
const { getSessionToken } = require('./utils');
45

@@ -254,7 +255,7 @@ module.exports = function(AV) {
254255
if (!getSessionToken(options) && owner == null && !AV.User.current()) {
255256
throw new Error('Please signin an user or pass the owner objectId.');
256257
}
257-
return getUser(options).then(owner => {
258+
return Promise.resolve(owner || getUser(options)).then(owner => {
258259
var params = {};
259260
params.inboxType = AV._encode(inboxType);
260261
params.owner = AV._encode(owner);
@@ -292,7 +293,7 @@ module.exports = function(AV) {
292293
if (!getSessionToken(options) && owner == null && !AV.User.current()) {
293294
throw new Error('Please signin an user or pass the owner objectId.');
294295
}
295-
return getUser(options).then(owner => {
296+
return Promise.resolve(owner || getUser(options)).then(owner => {
296297
var params = {};
297298
params.inboxType = AV._encode(inboxType);
298299
params.owner = AV._encode(owner);

test/status.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ describe('AV.Status', function() {
4545
response
4646
) {
4747
expect(response.total).to.be.a('number');
48+
expect(response.total).to.be.greaterThan(0);
4849
expect(response.unread).to.be.a('number');
50+
expect(response.unread).to.be.greaterThan(0);
4951
});
5052
});
5153
it('should return private statuses.', function() {

0 commit comments

Comments
 (0)