Reputation: 4615
How to get How many unread notifications does user have
on getStream?
I just need an integer
value of unread notifications.
(I will call the unread notifications the main like Facebook
or Instagram
!)
Thanks in advance
Upvotes: 2
Views: 911
Reputation: 2525
A typical response when fetching a Notification feed is:
> notificationFeed.get().then((response) => console.log(response));
Promise { _state: 0, _onFulfilled: [], _onRejected: [] }
> { results:
[ { activities: [Array],
activity_count: 1,
actor_count: 1,
created_at: '2017-12-27T10:15:39.215550',
group: 'e325120c-eaee-11e7-97ec-1283934ff98c',
id: 'e3267b75-eaee-11e7-8080-800052f2693c.e325120c-eaee-11e7-97ec-1283934ff98c',
is_read: false,
is_seen: false,
updated_at: '2017-12-27T10:15:39.215550',
verb: 'post' } ],
next: '',
duration: '12.76ms',
unseen: 1,
unread: 1 }
The unseen
and unread
properties on the response indicate the number of activities in the notification feed that are marked unseen, and unread respectively.
Upvotes: 3