mirror of
https://github.com/matrix-construct/construct
synced 2024-11-15 22:41:12 +01:00
modules/m_pusher: Count unread highlights instead of unread notifications.
This commit is contained in:
parent
90ac0d1a63
commit
cf674fcdf7
1 changed files with 12 additions and 9 deletions
|
@ -651,14 +651,9 @@ ircd::m::push::count_unread(const user &user,
|
|||
const event::idx &event_idx)
|
||||
{
|
||||
event::id::buf read_buf;
|
||||
const auto read_id
|
||||
{
|
||||
receipt::get(read_buf, room, user)
|
||||
};
|
||||
|
||||
const auto read_idx
|
||||
{
|
||||
index(std::nothrow, read_id)
|
||||
index(std::nothrow, receipt::get(read_buf, room, user))
|
||||
};
|
||||
|
||||
const event::idx_range unread_range
|
||||
|
@ -666,11 +661,19 @@ ircd::m::push::count_unread(const user &user,
|
|||
std::minmax(read_idx, event_idx)
|
||||
};
|
||||
|
||||
const user::notifications notifications
|
||||
{
|
||||
user
|
||||
};
|
||||
|
||||
user::notifications::opts opts;
|
||||
opts.room_id = room.room_id;
|
||||
opts.only = "highlight";
|
||||
opts.from = unread_range.second;
|
||||
opts.to = unread_range.first;
|
||||
const auto unread
|
||||
{
|
||||
read_idx?
|
||||
room::events::count(room, unread_range):
|
||||
0UL
|
||||
notifications.count(opts)
|
||||
};
|
||||
|
||||
return unread;
|
||||
|
|
Loading…
Reference in a new issue