mirror of
https://github.com/matrix-construct/construct
synced 2024-06-10 05:58:56 +02:00
ircd:Ⓜ️🧾 Simplify receipt freshness decisional.
This commit is contained in:
parent
2aea86eb29
commit
caf38d076a
|
@ -112,40 +112,26 @@ try
|
||||||
user_id
|
user_id
|
||||||
};
|
};
|
||||||
|
|
||||||
bool ret{true};
|
const m::event::idx event_idx
|
||||||
user_room.get("ircd.read", room_id, [&ret, &event_id]
|
|
||||||
(const m::event &event)
|
|
||||||
{
|
{
|
||||||
const auto &content
|
index(std::nothrow, event_id)
|
||||||
{
|
};
|
||||||
at<"content"_>(event)
|
|
||||||
};
|
|
||||||
|
|
||||||
const m::event::id &previous_id
|
if(!event_idx)
|
||||||
{
|
return true;
|
||||||
unquote(content.get("event_id"))
|
|
||||||
};
|
|
||||||
|
|
||||||
if(event_id == previous_id)
|
const auto last_idx
|
||||||
{
|
{
|
||||||
ret = false;
|
user_room.get(std::nothrow, "ircd.read", room_id)
|
||||||
return;
|
};
|
||||||
}
|
|
||||||
|
|
||||||
const m::event::idx &previous_idx
|
if(!last_idx)
|
||||||
{
|
return true;
|
||||||
index(previous_id)
|
|
||||||
};
|
|
||||||
|
|
||||||
const m::event::idx &event_idx
|
if(last_idx < event_idx)
|
||||||
{
|
return true;
|
||||||
index(event_id)
|
|
||||||
};
|
|
||||||
|
|
||||||
ret = event_idx > previous_idx;
|
return false;
|
||||||
});
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
catch(const std::exception &e)
|
catch(const std::exception &e)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue